php-general Digest 1 Dec 2002 00:36:26 -0000 Issue 1736
Topics (messages 126527 through 126580):
Re: Multidimensional arrays (more and more...)
126527 by: Paul Chvostek
126529 by: Paul Chvostek
Re: test for ascii or binary string
126528 by: Beth Gore
126532 by: Ernest E Vogelsinger
Re: Method for displaying Downline
126530 by: Rick Widmer
126531 by: Rick Widmer
Re: Test links?
126533 by: Rob Packer
126538 by: Jason Wong
126551 by: Rob Packer
126555 by: Jason Wong
126560 by: Beth Gore
126562 by: Chris Hewitt
126579 by: Rob Packer
Quota function
126534 by: EdwardSPL.ita.org.mo
126535 by: Jason Wong
126539 by: EdwardSPL.ita.org.mo
126541 by: Michael Sims
Language codes to textual languages.
126536 by: Noodle Snacks
Re: About Speech
126537 by: Mark Charette
Re: How Do I install php on Apache 2.0
126540 by: Tweak2x
Going Mad
126542 by: Andy
126543 by: Chris Hewitt
126544 by: Phil Driscoll
126545 by: Chris Hewitt
126546 by: Andy
126547 by: Chris Hewitt
126548 by: Andy
126556 by: Phil Driscoll
126558 by: Chris Hewitt
126565 by: Chris Hewitt
How to override header info in mail()
126549 by: Phil Powell
126557 by: Paul Nicholson
126580 by: Paul Nicholson
last updated ?
126550 by: Paul O'Neil
126552 by: Beth Gore
126559 by: Chris Hewitt
PHP confirmation window
126553 by: Lars Espelid
126563 by: Jason Sheets
Page break
126554 by: Lars Espelid
OS X and cURL Issues
126561 by: Weston Houghton
126564 by: Sterling Hughes
Redirect opening in a new window
126566 by: Troy May
126568 by: Jason Sheets
126569 by: Troy May
Function passed as argument to function
126567 by: Jeffrey B.Ferland
126572 by: Jason Wong
126574 by: Jeffrey B.Ferland
126578 by: Jason Wong
Read Files
126570 by: Randum Ian
126571 by: Randum Ian
126573 by: Chris Wesley
126575 by: Randum Ian
126577 by: Randum Ian
domxml?
126576 by: Devin
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Well, counting is easy... count($issue) will be correct. If you want
to count things that match only specific elements, use things like:
$c=0;
foreach($issue as $what)
if ( $year==2003 && $month>=5 )
$c++;
As I said in the previous email, to sort by array elements, you'd need
to use array_multisort. Something like...
$sortkey=array();
foreach($issue as $what)
$sortkey[]=$what['number'];
array_multisort($issue,$sortkey);
And for looping, foreach is still your best bet:
foreach($issue as $key => $what) {
if ($what['senttosubscribers']==0)
$issue[$key]['description'].=" (EMPTY)";
else
$issue[$key]['description'].=str_replace(" (EMPTY)","",$what['description']);
}
With regard to PHP being "screwey", I haven't found this -- I use
multidimensional arrays quite a bit and find that they behave exactly as
I would predict. Maybe I'm just lucky. ;-)
p
On Thu, Nov 28, 2002 at 09:55:25AM -0800, Mako Shark wrote:
>
> Wow. This goes way beyond simply printing
> multidimensional arrays. Here's some sample data:
>
> $issue[]["number"] = "number";
> $issue[]["headline"] = "headling";
> $issue[]["writers"] = "writers";
> $issue[]["list"] = "list";
> $issue[]["senttosubscribers"] = "0";
> $issue[]["month"] = "05";
> $issue[]["year"] = "2003";
> $issue[]["description"] = "description";
>
> What I need to do now is count(), sort() by number,
> and loop through this array.
>
> I read that PHP is screwy when counting and sorting
> multidimensional arrays, but they *have* to have come
> up with a method, right?
--
Paul Chvostek <[EMAIL PROTECTED]>
Operations / Abuse / Whatever +1 416 598-0000
it.canada - hosting and development http://www.it.ca/
--- End Message ---
--- Begin Message ---
On Thu, Nov 28, 2002 at 10:19:38AM -0800, Mako Shark wrote:
...
> My problem is I need to loop through these. So I can't
> just assume that the count is count($issue[]) divided
> by 8, because that won't work in a for loop. I suppose
> I could just iterate through my for loop in jumps of
> 8, but that seems really hacky and unintuitive to
> whomever has to figure out my code when I'm gone.
By your description, count($issue)/count($issue[]) is the number of
real elements. And a foreach loop will correctly step through whatever
array you pass to it, even if the values of that array are themselves
arrays. Or could you try something like count(array_keys($issue)) ...
or the loop could be as simple as:
$count=0; foreach($issue as $junk) $count++;
which is clear, though to my eye is the same as count();
I'm surprised that count($issue) would report something other than the
number of elements in $issue. I never count my multidimensional arrays
so it's never come up for me. :-/
--
Paul Chvostek <[EMAIL PROTECTED]>
Operations / Abuse / Whatever +1 416 598-0000
it.canada - hosting and development http://www.it.ca/
--- End Message ---
--- Begin Message ---
Morgan Hughes wrote:
On Fri, 29 Nov 2002, Jonathan Sharp wrote:
Is there a way to determine if a string has ascii or binary data in it?
I just wrote this, it seems to work. I've used mhash to generate a
binary string. It will fail if:
a) The strings use obscure ASCII control characters other than LF, CR
and Horizontal Tab.
b) You're expecting strings with european charater's with umlouts and
stuff like that.
You can add these characters to the list of exclusions on line 16 of
this code.
Hope this helps!!!
Beth Gore
<?php
function isbinary($input)
{
/* This simple function returns true if there's any non-standard Ascii
characters */
$isbinary = 0;
for($x=0;$x < strlen($input); $x++)
{
$c = substr($input,$x,1);
if($c < chr(32) or $c > chr(127))
{
if($c != chr(10) or $c != chr(13) or $c != chr(9)) /* add expected
european extended characters */
{
$isbinary = 1;
}
}
}
return $isbinary;
}
$binary = mhash(MHASH_MD5,"test");
$ascii = "Hello, this is a normal string;";
$strings = array(1 => $binary, 2=> $ascii);
while(list($id, $string) = each($strings)){
if(isbinary($string)){
echo "string ".$id." verified as binary<br>";
}else{
echo "string ".$id." verified as ascii<br>";
}
}
?>
--
--- End Message ---
--- Begin Message ---
At 13:38 30.11.2002, Beth Gore said:
--------------------[snip]--------------------
Add a "break" statement once you've detected binary, for optimization
(binary might be just some length...)
<?php
>function isbinary($input)
{
/* This simple function returns true if there's any
non-standard Ascii characters */
$isbinary = 0;
for($x=0;$x < strlen($input); $x++) {
$c = substr($input,$x,1);
if($c < chr(32) or $c > chr(127)) {
/* add expected european extended characters */
if($c != chr(10) or $c != chr(13) or $c != chr(9)) {
$isbinary = 1;
/* >>> */ break;
}
}
}
return $isbinary;
}
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--- End Message ---
--- Begin Message ---
At 06:47 PM 11/29/02 -0800, Daren Cotter wrote:
Must you send three separate requests to the list? One is enough.
You might find some useful information here:
http://marc.theaimsgroup.com/?l=php-general&m=95423103630080&w=2
--- End Message ---
--- Begin Message ---
IT IS CONSIDERED VERY RUDE TO SPAM THE LIST WITH REPEATED MESSAGES!!!!
ONE IS ENOUGH!!!!!!
Yes, I am shouting.
--- End Message ---
--- Begin Message ---
Well, the reason I didn't do that at first was that I could have done any of
the methods that I've tried incorrectly, which is why I figured I'd ask what
works and then focus on that method... but, I've tried to ping them, use
fopen, and use fsocketopen... but nothing says that I've used any of them
the way I should have :) I also tried to use the scripts that I found at
hotscripts.com but I always seem to get inconsistent results and it must be
accurate.
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Saturday 30 November 2002 06:53, Rob Packer wrote:
> > First, I'd like to say that I'm not asking for anyone to write a
script...
> > how would I go about checking a MySQL database of links to see if any
are
> > down?
> >
> > I've had some varying results with all the methods I've tried, so would
> > like to see if anyone has a proven method for doing this.
>
> Why don't you briefly summarise what methods you have tried? That way
people
> won't reply with methods that you already know of.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Between grand theft and a legal fee, there only stands a law degree.
> */
>
--- End Message ---
--- Begin Message ---
On Saturday 30 November 2002 21:40, Rob Packer wrote:
> Well, the reason I didn't do that at first was that I could have done any
> of the methods that I've tried incorrectly, which is why I figured I'd ask
> what works and then focus on that method... but, I've tried to ping them,
> use fopen, and use fsocketopen... but nothing says that I've used any of
> them the way I should have :) I also tried to use the scripts that I found
> at hotscripts.com but I always seem to get inconsistent results and it must
> be accurate.
Investigate the use of file(). It should be the most reliable indicator of
whether or not a link is valid.
Using ping on it's own doesn't really help much. A server may be configured to
ignore ping requests. And even if a server responds to a ping request it
doesn't mean the webserver is up and running.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Nothing astonishes men so much as common sense and plain dealing.
-- Ralph Waldo Emerson
*/
--- End Message ---
--- Begin Message ---
Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
alot valid URLs... does this look to be correct usage?
$url = $row[0]; // just get the url from the db
$fp = implode ('', file ($url));
if (!$fp) {echo "<font color=red><b>Unable to access file</b></font>"; }
else { fclose($fp); echo "The link is working!"; }
It seems I always get this warning...
Warning: Supplied argument is not a valid File-Handle resource in
/web/home/nrc.net/www/robert/links4.php on line 11
If someone can tell me what I'm doing wrong, I'd appreciate it.
Thanks,
Robert
--- End Message ---
--- Begin Message ---
On Sunday 01 December 2002 02:06, Rob Packer wrote:
> Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
> alot valid URLs... does this look to be correct usage?
> $url = $row[0]; // just get the url from the db
> $fp = implode ('', file ($url));
> if (!$fp) {echo "<font color=red><b>Unable to access file</b></font>"; }
> else { fclose($fp); echo "The link is working!"; }
>
> It seems I always get this warning...
>
> Warning: Supplied argument is not a valid File-Handle resource in
> /web/home/nrc.net/www/robert/links4.php on line 11
Which is line 11?
In the above, if link was valid and returned something then $fp would be a
string containing the HTML source of the $url. If the link was invalid (I'm
not sure what exactly PHP would regard as an invalid link) then PHP would
output a warning/error message (make sure you have error reporting set to an
appropriately high level).
file() implicitly opens and closes the file for you so no need for fclose().
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
The rhino is a homely beast,
For human eyes he's not a feast.
Farewell, farewell, you old rhinoceros,
I'll stare at something less prepoceros.
-- Ogden Nash
*/
--- End Message ---
--- Begin Message ---
Rob Packer wrote:
Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
alot valid URLs... does this look to be correct usage?
$url = $row[0]; // just get the url from the db
$fp = implode ('', file ($url));
if (!$fp) {echo "<font color=red><b>Unable to access file</b></font>"; }
else { fclose($fp); echo "The link is working!"; }
It seems I always get this warning...
Warning: Supplied argument is not a valid File-Handle resource in
/web/home/nrc.net/www/robert/links4.php on line 11
If someone can tell me what I'm doing wrong, I'd appreciate it.
Thanks,
Robert
When fopen successfully opens a file it populates an array
$http_response_header, which you can examine to see if the link works or
not - I don't believe you can actually get the file itself, but since
that's not what we're after that's not a problem!
Having said that, fopen produces a very annoying error if it doesn't
find the page, but I found the following works:
<?php
$SQL = "SELECT linkurl, linkID FROM links";
$result = mysql_query($SQL);
while($linkdata = mysql_fetch_array($result)){
$fp = fopen($linkdata['linkurl'],"r");
if($fp)
{
echo "<p>".$linkdata['linkurl']." is still valid.</p>";
}else{
echo "<p>".$linkdata['linkurl']." is invalid. Updating
database... ";
$SQL = "UPDATE links SET status = 0 WHERE linkID =
'".$linkdata['linkID']."'";
$result2 = mysql_query($SQL);
if($result2)
{
echo "Database updated</p>";
}
}
}
?>
Rather than deleting the link, it's probably better to set a flag to
show it was invalid last time you checked, but check it again next time.
Or you could keep a count of the number of failed attempts, and delete
if it goes beyond 3 or so.
Not sure how to supress the warning message that PHP automatically does
when you haven't got a valid URL though.
Hope this works for you!
Beth Gore
--
http://bethanoia.dyndns.org
--- End Message ---
--- Begin Message ---
Rob Packer wrote:
Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
alot valid URLs... does this look to be correct usage?
$url = $row[0]; // just get the url from the db
$fp = implode ('', file ($url));
if (!$fp) {echo "<font color=red><b>Unable to access file</b></font>"; }
else { fclose($fp); echo "The link is working!"; }
It seems I always get this warning...
Warning: Supplied argument is not a valid File-Handle resource in
/web/home/nrc.net/www/robert/links4.php on line 11
I think you have assigned $fp to be the imploded string, not a file
pointer. Thus fclose($fp) would generate an error. Given this, I'm not
sure what "if (!$fp)" would mean.
HTH
Chris
--- End Message ---
--- Begin Message ---
Thanks for the help and suggestions everybody!
I think some of my problems stemmed from the affiliate links being
redirected and PHP saw that as dead(so to speak)... but I think I got it
now. I made another column in the database to note a redirection for ones
that the url fails but the $url[host] passes.
Robert Packer
"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Rob Packer wrote:
>
> >Okay, I'm confused... file, fopen, and fsockopen seem to say not found on
> >alot valid URLs... does this look to be correct usage?
> >$url = $row[0]; // just get the url from the db
> >$fp = implode ('', file ($url));
> > if (!$fp) {echo "<font color=red><b>Unable to access file</b></font>"; }
> > else { fclose($fp); echo "The link is working!"; }
> >
> >It seems I always get this warning...
> >
> >Warning: Supplied argument is not a valid File-Handle resource in
> >/web/home/nrc.net/www/robert/links4.php on line 11
> >
> I think you have assigned $fp to be the imploded string, not a file
> pointer. Thus fclose($fp) would generate an error. Given this, I'm not
> sure what "if (!$fp)" would mean.
>
> HTH
> Chris
>
>
--- End Message ---
--- Begin Message ---
Dear all,
How to write a Quota function with php code ?
Require : different Server machine, userid and password also
Mine is Linux Redhat system...
Thank for your help !
Edward.
--- End Message ---
--- Begin Message ---
On Saturday 30 November 2002 21:47, [EMAIL PROTECTED] wrote:
> Dear all,
>
> How to write a Quota function with php code ?
> Require : different Server machine, userid and password also
>
> Mine is Linux Redhat system...
if ($current > $quota) { echo "Quota exceeded"; }
IOW please elaborate on what you're trying to do.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Writing about music is like dancing about architecture.
-- Frank Zappa
*/
--- End Message ---
--- Begin Message ---
Jason Wong wrote:
> On Saturday 30 November 2002 21:47, [EMAIL PROTECTED] wrote:
> > Dear all,
> >
> > How to write a Quota function with php code ?
> > Require : different Server machine, userid and password also
> >
> > Mine is Linux Redhat system...
>
> if ($current > $quota) { echo "Quota exceeded"; }
>
> IOW please elaborate on what you're trying to do.
There is a php code from Internet, it is enable Quota function with wu-imap
server, but I can't run it into my server ( Linux Redhat system ) like
http://www.ita.org.mo/~edward/imp/screenshot.gif...
if (!function_exists('imp_show_quota')) {
function imp_show_quota ($imp) {
$imap_admin = $imp['user'];
$passwd_array = posix_getpwnam($imap_admin);
$homedir = split("/", $passwd_array['dir']);
$realname = split(",", $passwd_array['gecos']);
$quota_html = '<table width="100%" border="0" cellpadding="0"
cellspacing="0"><tr><td class="item"><table border="0" cellspacing="0"
cellpadding="0" width="100%"><tr>';
$quota_html .= '<td align="left" class="header">Login: ' .
$realname[0] . " (" . $imap_admin . ")" . '</td>';
$junk = exec("sudo quota -u $imap_admin | grep $homedir[1]",
$quota_data,$return_code);
if ($return_code == 0 && count($quota_data) == 1) {
$splitted = split("[[:blank:]]+", trim($quota_data[0]));
$taken = $splitted[1] / 1000 ; $total = $splitted[2] / 1000 ;
$percent = $taken * 100 / $total ;
if ($percent >= 90) {
$class = 'quotaalert';
} elseif ($percent >= 80) {
$class = 'quotawarn';
} else {
$class = 'header';
}
$quota_html .= '<td align="right" class="' . $class . '">';
$quota_html .= sprintf("Quota on /%s: %.1fMB/%.1fMB (%.1f%%)",
$homedir[1], $taken, $total, $percent);
} else {
$quota_html .= '<td align="right" class="header">';
$quota_html .= "Quota not available";
}
$quota_html .= '</td></tr></table></td></tr></table>';
return $quota_html;
}
}
Thank for your help !
Edward.
--- End Message ---
--- Begin Message ---
On Sat, 30 Nov 2002 23:36:20 +0800, you wrote:
>There is a php code from Internet, it is enable Quota function with wu-imap
>server, but I can't run it into my server ( Linux Redhat system ) like
There is a mailing list that is specifically for Imp. You'd have
better luck getting answers if you sent your question to that list:
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Via $_SERVER['HTTP_ACCEPT_LANGUAGE'] you can get the default language of a
browser (usually).
Does anyone know of a list that has the conversion from say: "en-au" to
"Australia" or "en-us" to "U.S.A"?
--
JJ Harrison
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ing. Raúl González Rodríguez [mailto:[EMAIL PROTECTED]]
>
> I need to know if it's possible generate a wav, mid or mp3 file
> from php.
You could write a custom interface to _generate_ the file (MIDI is _very_
different than the other two types; are you sure you understand exactly what
you intend to do?), but where is the input coming from to begin with? The
currently available tools to make audio files are already pretty
sophisticated, and trying to replicate them in PHP would probably not be the
best use of your time.
Sending the files doesn't require any changes to anything. Just create an
ANCHOR link to the file and it'll be sent on its merry way when the user
clicks on the link.
Mark C.
--- End Message ---
--- Begin Message ---
I got it working, thanks guys. I just Put on Apache 1.0.3 and emaild
support. They game me some thing to add into the httpd.conf. My site address
is http://tweak2x.yi.org
"-<>-" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Adam Voigt,
>
> On 27 Nov 2002 11:44:49 -0500, you wrote about "Re: [PHP] How Do I install
> php on Apache 2.0" something that looked like this:
>
> >A. What does having Adobe installed matter?
>
> Where'd you get that??
>
> >B. Why are you trying to run 2.0? Apache 2.0 isn't even recommended for
> >use with PHP on linux systems yet, let alone windows. You'd have much
> >better luck with the 1.3.27 version.
>
> Why not??? I'm running a custom built Apache 2.0.40 with the latest PHP
> and it works trouble free on WinXP ...
>
> Granted, this is for experimental testing only ... I'd never have a public
> server running Windows in any shape or form any way...
>
>
--- End Message ---
--- Begin Message ---
Can someone please help, i think i am going mad.
I have just installed Apache, php and Mysql, it all seems to be fine, the
Apache server says it is ok, i think i have set the config file correctly,
and Mysql look to be correct, but when i typed the code (My first code)
<?php echo "this is a php line"; phpinfo(); ?>
and save it test.php when i look at it in explorer all i see the preceding
html code. hat have i done wrong?
I am using windows 2000 pro.
Thank you
--- End Message ---
--- Begin Message ---
Andy wrote:
<?php echo "this is a php line"; phpinfo(); ?>
and save it test.php when i look at it in explorer all i see the preceding
html code. hat have i done wrong?
I am using windows 2000 pro.
It seems as though you have not added the AddType line for php in
httpd.conf and restarted Apache. If your file is test.php then the
".php" must be part of the AddType line.
HTH
Chris
--- End Message ---
--- Begin Message ---
On Saturday 30 November 2002 5:31 pm, Chris Hewitt wrote:
> Andy wrote:
> ><?php echo "this is a php line"; phpinfo(); ?>
> >and save it test.php when i look at it in explorer all i see the preceding
> >html code. hat have i done wrong?
> >I am using windows 2000 pro.
>
> It seems as though you have not added the AddType line for php in
> httpd.conf and restarted Apache. If your file is test.php then the
> ".php" must be part of the AddType line.
...or you are viewing the page as file://foo.php rather than
http://localhost/foo.php
Cheers
--
Phil Driscoll
--- End Message ---
--- Begin Message ---
Andy Davey wrote:
Hi Chris
I have added AddType application/x-httpd-php .php to the httpd config file,
and restarted it, but still no luck.
Andy
Hmm. I take it the file you are trying to get at (via http:// as Phil
says) has got a php extension? I assume there are no <IfModule> or
<Directory> or <VirtualHost> tags around the line that are not applicable.
Is the httpd.conf you are editing the one being looked at by apache? To
test this I usually put some rubbish into httpd.conf, restart apache and
check that it groans and won't start.
Just some thoughts, hoping they help.
Chris
PS Please copy replies to the list.
--- End Message ---
--- Begin Message ---
"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Andy Davey wrote:
>
> >Hi Chris
> >
> >I have added AddType application/x-httpd-php .php to the httpd config
file,
> >and restarted it, but still no luck.
> >
> >Andy
> >
> Hmm. I take it the file you are trying to get at (via http:// as Phil
> says) has got a php extension? I assume there are no <IfModule> or
> <Directory> or <VirtualHost> tags around the line that are not applicable.
>
> Is the httpd.conf you are editing the one being looked at by apache? To
> test this I usually put some rubbish into httpd.conf, restart apache and
> check that it groans and won't start.
>
> Just some thoughts, hoping they help.
>
> Chris
> PS Please copy replies to the list.
>
There are two, one of which is the default assume that is the one I edit?
--- End Message ---
--- Begin Message ---
Andy Davey wrote:
There are two httpd config files, one of which is default, i take it that is
the one you edit?
I know it is something simple, which is why i cannot se it!
There should only be one. I suggest you put some rubbish into one and
restart apache. If it does not complain then it is not the one apache is
looking at.
If you have php compiled as a DSO then you will also need the LoadModule
line.
HTH
Chris
PS Please copy replies to the list.
--- End Message ---
--- Begin Message ---
"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Andy Davey wrote:
>
> >There are two httpd config files, one of which is default, i take it that
is
> >the one you edit?
> >I know it is something simple, which is why i cannot se it!
> >
> There should only be one. I suggest you put some rubbish into one and
> restart apache. If it does not complain then it is not the one apache is
> looking at.
>
> If you have php compiled as a DSO then you will also need the LoadModule
> line.
>
> HTH
> Chris
> PS Please copy replies to the list.
>
Can i type anything into the file or should it be code, you will have to
treat me a a total novice, i only started reading the book yesterday so i am
not sure of the jargon yet.
Also compiled as a DSO?
Hmm.. not typed LoadModule...
but the book which is PHP & MySQL for dummies BTW, whcih is about right,
says nothing about that.
Andy
--- End Message ---
--- Begin Message ---
On Saturday 30 November 2002 5:32 pm, Andy Davey wrote:
> Hi Phil
>
> It took me a while to get the local host to show the apache welcome screen,
> but now that I have I am still unable to see the page, I have the file
> saved on my desktop, should I have the test.php file saved anywhere else?
>
> I created the file in Dreamweaver MX, and saved it as test.php not sure if
> this can give you any clues?
>
> Andy
There's your problem.
Assuming you haven't messed about too much with the apache config, your php
file needs to live inside apache's htdocs directory. Can't remember exactly
where that would be on a windows box - something like c:/program files/apache
group/apache/htdocs maybe.
Cheers
--
Phil Driscoll
--- End Message ---
--- Begin Message ---
Andy wrote:
"Chris Hewitt" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Can i type anything into the file or should it be code, you will have to
Yes, anything. If apache does not understand it then it will not start
up. Don't put a hash at the beginning of your rubbish line as hash means
a comment. Know what you have entered so that you can remove it afterwards.
Also compiled as a DSO?
Hmm.. not typed LoadModule...
There are three ways to compile php. One is as part of Apache itself,
this is best if most of what the webserer does is php. Then there is a
DSO (dynamic shared object), this is basically what Windows calls a
dynamically linked library (.dll). It only gets called into memory if
needed. This is best if most of what the webserver does is not php. Then
there is php as a stand-alone executable (php.exe).
In order to configure httpd.conf you will need to know which you have.
I've no experience of running php under Windows (only linux) but it
seems most of the installations available are pre-compiled and easy to
install. There should be instructions with your installation telling you
how php is configured.
Running "httpd -l" from the command prompt (I assume this works in
windows as well as linux), will show you what modules are compiled into
apache. If "mod_php4" comes up then php is compiled into apache and you
do not need the LoadModule line. If "mod_php4" is not shown but "mod_so"
is then php may be an Apache module (DSO) or stand alone (sometimes
called CLI or CGI). "mod_so" is the module that facilitates dynamic
modules so that it is essential for any modules to work.
I think you need to refer to the instructions for your installation for
this, not a book.
but the book which is PHP & MySQL for dummies BTW, whcih is about right,
says nothing about that.
I have not seen this book. It may simply assume an installation is
already available and leave out installing it. Many books were written
when register_globals was "on" by default, now it is "off" for security
reasons. If, when you come to do code, you do not get variables passed
from one page to another then either turn it back on (in php.ini) or
(better) use the super-globals $_GET['var'} and $_POST['var'], but that
is getting ahead, let's get your installation working first...
Chris
--- End Message ---
--- Begin Message ---
Phil Driscoll wrote:
There's your problem.
Assuming you haven't messed about too much with the apache config, your php
file needs to live inside apache's htdocs directory. Can't remember exactly
where that would be on a windows box - something like c:/program files/apache
group/apache/htdocs maybe.
Yes, Phil has it. I'd assumed this, I should not have. The directory is
given by the "DocumentRoot" line in httpd.conf. You did not say exectly
what error you were getting, I'd assumed that you were just seeing the
source of your file and that the only problem was php not parsing it.
Presumably you were getting "Document not found" errors?
Chris
--- End Message ---
--- Begin Message ---
I am using this line:
if (!mail($to, $subject, $body, "From: " . $from . ";" . header("Content-type " .
$contentType))) {..}
to use the mail() function in PHP to send simple text/plain or text/html email.
However, upon attempting to send I get a warning message indicating that header
information has already been set prior to emailing.
Is there a way to overwrite only certain header information prior to emailing to
ensure the content-type of the email being either text/plain or text/html?
Just wondering
Thanx
Phil
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey,
The correct way of doing that is:
if (!mail($to, $subject, $body, "From: ". $from ."\r\nContent-type". $contentType))
{..}
HTH!
~Paul
On Saturday 30 November 2002 12:58 pm, Phil Powell wrote:
> I am using this line:
>
> if (!mail($to, $subject, $body, "From: " . $from . ";" .
> header("Content-type " . $contentType))) {..}
>
> to use the mail() function in PHP to send simple text/plain or text/html
> email. However, upon attempting to send I get a warning message indicating
> that header information has already been set prior to emailing.
>
> Is there a way to overwrite only certain header information prior to
> emailing to ensure the content-type of the email being either text/plain or
> text/html?
>
> Just wondering
> Thanx
> Phil
- --
~Paul Nicholson
Design Specialist @ WebPower Design
[EMAIL PROTECTED]
www.webpowerdesign.net
"The web....the way you want it!"
"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE96QeuDyXNIUN3+UQRAkFEAJ0SBT8VZMHitu4zOOb+cf3jaRCX7QCffEpD
txhpy024829NozyhYq6H3Fk=
=Szfo
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
ok, what is on line 13 and on line 104?
That error is saying that you have a header() call on line 104 that I don't
think should be there(The header command is not used with mail)....if it
should you'll have to look at output buffering.
~Pauly
http://php.net/manual/en/function.header.php
http://php.net/manual/en/function.mail.php
http://php.net/manual/en/ref.outcontrol.php
On Saturday 30 November 2002 02:37 pm, Phil Powell wrote:
> I'm sorry that didn't work either.. here is my error:
>
> Warning: Cannot add header information - headers already sent by (output
> started at /users/ppowell/web/recommend.php:13) in
> /users/ppowell/web/recommend.php on line 104
>
>
> Phil
> ----- Original Message -----
> From: "Paul Nicholson" <[EMAIL PROTECTED]>
> To: "Phil Powell" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Saturday, November 30, 2002 1:46 PM
> Subject: Re: [PHP] How to override header info in mail()
>
> > Hey,
> > The correct way of doing that is:
> > if (!mail($to, $subject, $body, "From: ". $from ."\r\nContent-type".
>
> $contentType)) {..}
>
> > HTH!
> > ~Paul
> >
> > On Saturday 30 November 2002 12:58 pm, Phil Powell wrote:
> > > I am using this line:
> > >
> > > if (!mail($to, $subject, $body, "From: " . $from . ";" .
> > > header("Content-type " . $contentType))) {..}
> > >
> > > to use the mail() function in PHP to send simple text/plain or
> > > text/html email. However, upon attempting to send I get a warning
> > > message
>
> indicating
>
> > > that header information has already been set prior to emailing.
> > >
> > > Is there a way to overwrite only certain header information prior to
> > > emailing to ensure the content-type of the email being either
> > > text/plain
>
> or
>
> > > text/html?
> > >
> > > Just wondering
> > > Thanx
> > > Phil
- --
~Paul Nicholson
Design Specialist @ WebPower Design
[EMAIL PROTECTED]
www.webpowerdesign.net
"The web....the way you want it!"
"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE96VjYDyXNIUN3+UQRArAqAKCLtc0i7iNJyCcZ14/midkP3JFZXACaAgfk
FBrQwCIlYgxRyj9UFNhh4HQ=
=XosZ
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Dumb question here but whats the general practice regarding putting a
"website last updated:" entry on a web page? Does the web master manually
enter in today's date in a database table entry and let PHP display. Is it
statically added to the HTML page? Etc...
--- End Message ---
--- Begin Message ---
Paul O'Neil wrote:
Dumb question here but whats the general practice regarding putting a
"website last updated:" entry on a web page? Does the web master manually
enter in today's date in a database table entry and let PHP display. Is it
statically added to the HTML page? Etc...
I've just implimented that very thing in my site! Very simple. I have a
MySQL table that features master site details, including the stylesheet,
site title, that sort of thing. One column is a Datetime type.
In all the admin pages that add anything new to the site, the last
update time is updated using:
<?php
$SQL = "UPDATE site SET LastUpdate='".date("Y-m-d G:i:s")."' WHERE
SiteID=1";
$result = mysql_query($SQL);
?>
Then, in the site's standard footer I have the following:
<p class="scribbles">Last Updated:
<?php
$timestamp = strtotime($sitedata["LastUpdate"]);
echo date("G:i, D \T\h\e jS of M, Y ",$timestamp);
?>
</p>
This then shows the last update time on the browser, and I also set the
page to expire at that time, so in that way (I understand) browsers know
if the page has been updated since you last looked.
--
Beth Gore
http://bethanoia.dyndns.org
--- End Message ---
--- Begin Message ---
Paul O'Neil wrote:
Dumb question here but whats the general practice regarding putting a
"website last updated:" entry on a web page? Does the web master manually
enter in today's date in a database table entry and let PHP display. Is it
statically added to the HTML page? Etc...
If you want "website last updated" then from a database sounds OK but
where I'm working its commonly a "page last updated" wanted. In this
case its just a manually entered date in html in the page.
Chris
--- End Message ---
--- Begin Message ---
Hello,
Working in php, the problem is how to create a window with some optional
text in it and get true or false in return. A confirmation window.
Example in javascript:
function formSubmit() {
window.event.returnValue = false;
if (confirm("Er du sikker på at du vil slette boenheten?"))
window.event.returnValue = true;
}
regards
lars
--- End Message ---
--- Begin Message ---
If you are wanting to do it on the client side you will need to do it in
javascript, not in PHP.
If you just want to make a confirmation screen in PHP you just present
an intermediate screen between the requested action and completing that
action.
An example would be:
1. Administrator clicks delete user link that is a GET query string
2. PHP application creates a page with 2 links or form buttons, Yes or
No
3. PHP application takes action as a result of the choice taken for
example <a href="admin.php?action=deluser&userid=1&confirm=t">Yes</a> <a
href="admin.php?action=deluser&userid=1&confirm=f">No</a>
Jason
On Sat, 2002-11-30 at 11:22, Lars Espelid wrote:
> Hello,
>
> Working in php, the problem is how to create a window with some optional
> text in it and get true or false in return. A confirmation window.
>
> Example in javascript:
>
> function formSubmit() {
> window.event.returnValue = false;
> if (confirm("Er du sikker på at du vil slette boenheten?"))
> window.event.returnValue = true;
> }
>
>
> regards
> lars
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello,
Is there some way to insert page breaks in a php document so that it becomes
more printer friendly.
thanks
lars
--- End Message ---
--- Begin Message ---
I'm working on getting the following install working under OS 10.2.2:
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/share/man \
--with-apxs=/usr/sbin/apxs \
--with-mysql \
--with-gd=/usr/local \
--with-png-dir=/usr/local \
--with-zlib-dir=/usr/local \
--with-jpg-dir=/usr/local \
--with-freetype-dir=/usr/local \
--enable-trans-sid \
--enable-exif \
--enable-ftp \
--enable-calendar \
--with-curl=/usr/lib \
--with-flatfile \
--with-ming=/Users/whoughto/src/ming-0.2a \
--enable-sockets \
--with-jave=/Library/Java/Home \
--with-xml
And Curl keeps throwing me the following error, but as you can see, I
do indeed have 7.9.8 installed. Any ideas?
checking for CURL support... yes
checking for CURL in default path... found in /usr
checking for cURL 7.9.8 or greater... configure: error: cURL version
7.9.8 or later is required to compile php with cURL support
[user/src/php4rc2] root# curl --help
curl 7.9.8 (powerpc-apple-darwin5.5) libcurl 7.9.8
Thanks,
Wes
--- End Message ---
--- Begin Message ---
you need to upgrade the bundled cURL to version 7.9.8 (soon to be
7.10.2), or install a special version of the cURL library for PHP's
installation.
-Sterling
> I'm working on getting the following install working under OS 10.2.2:
>
> ../configure --prefix=/usr \
> --sysconfdir=/etc \
> --localstatedir=/var \
> --mandir=/usr/share/man \
> --with-apxs=/usr/sbin/apxs \
> --with-mysql \
> --with-gd=/usr/local \
> --with-png-dir=/usr/local \
> --with-zlib-dir=/usr/local \
> --with-jpg-dir=/usr/local \
> --with-freetype-dir=/usr/local \
> --enable-trans-sid \
> --enable-exif \
> --enable-ftp \
> --enable-calendar \
> --with-curl=/usr/lib \
> --with-flatfile \
> --with-ming=/Users/whoughto/src/ming-0.2a \
> --enable-sockets \
> --with-jave=/Library/Java/Home \
> --with-xml
>
> And Curl keeps throwing me the following error, but as you can see, I
> do indeed have 7.9.8 installed. Any ideas?
>
> checking for CURL support... yes
> checking for CURL in default path... found in /usr
> checking for cURL 7.9.8 or greater... configure: error: cURL version
> 7.9.8 or later is required to compile php with cURL support
> [user/src/php4rc2] root# curl --help
> curl 7.9.8 (powerpc-apple-darwin5.5) libcurl 7.9.8
>
> Thanks,
> Wes
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hello,
I'm playing with a portal system now and I need to edit a module to redirect
to another site/page. I have done this with a header() redirection, but it
takes the current window.
How can I do this and have it open a new window for the redirect?
--- End Message ---
--- Begin Message ---
Look at javascript, you could use javascript to both open a new window
and set the location or you could use javascript to open the new window
to a PHP script that uses header() to forward the user.
Be aware that some users disable javascript completely or just disable
new windows to avoid popups and pop under advertising.
Jason
On Sat, 2002-11-30 at 12:55, Troy May wrote:
> Hello,
>
> I'm playing with a portal system now and I need to edit a module to redirect
> to another site/page. I have done this with a header() redirection, but it
> takes the current window.
>
> How can I do this and have it open a new window for the redirect?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
That easy solution is not so easy for me. This portal system is PHP-Nuke.
There's different themes, pages, etc. It would take me 3 weeks to find and
edit all the links in a 2000 file directory.
I just need to be able to do this from the called module itself, and that
would take care of all the pages/themes in one shot.
-----Original Message-----
From: Jeffrey B.Ferland [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 30, 2002 12:02 PM
To: Troy May
Subject: Re: [PHP] Redirect opening in a new window
On Saturday 30 November 2002 02:55 pm, you wrote:
> Hello,
>
> I'm playing with a portal system now and I need to edit a module to
> redirect to another site/page. I have done this with a header()
> redirection, but it takes the current window.
>
> How can I do this and have it open a new window for the redirect?
<a href="/link.htm" target="_blank">Displayed Link</a>
-Jeff
SIG: HUP
--- End Message ---
--- Begin Message ---
std_layout("Title here", list_writings(poetry))
both std_layout and list_writings are user-defined functions. std_layout()
echo's the two arguments that it takes at select points in its execution. I
want to the output of list_writings() to be an argument for std_layout().
-Jeff
SIG: HUP
--- End Message ---
--- Begin Message ---
On Sunday 01 December 2002 03:54, Jeffrey B.Ferland wrote:
> std_layout("Title here", list_writings(poetry))
>
> both std_layout and list_writings are user-defined functions. std_layout()
> echo's the two arguments that it takes at select points in its execution. I
> want to the output of list_writings() to be an argument for std_layout().
Hmm, what's the problem then?
Functions take any valid expressions as arguments. If list_writings() returns
a valid expression then you should have no problems at all.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Play Rogue, visit exotic locations, meet strange creatures and kill them.
*/
--- End Message ---
--- Begin Message ---
On Saturday 30 November 2002 03:14 pm, you wrote:
> On Sunday 01 December 2002 03:54, Jeffrey B.Ferland wrote:
> > std_layout("Title here", list_writings(poetry))
> >
> > both std_layout and list_writings are user-defined functions.
> > std_layout() echo's the two arguments that it takes at select points in
> > its execution. I want to the output of list_writings() to be an argument
> > for std_layout().
>
> Hmm, what's the problem then?
>
> Functions take any valid expressions as arguments. If list_writings()
> returns a valid expression then you should have no problems at all.
For reference, see http://autocracy.homelinux.org/template.php and
http://autocracy.homelinux.org/error.php
template.php is the proper layout, and uses the same code as
error.php, with the exception that "LEFT SIDE TEXT" has been replaced with
'list_writings(poetry)'. Note that the output from that function occurs where
it was placed within the code, not where it was called to...
Basically, instead of the output from list_writings(poetry) being passed to
the function, it simply executes.
-Jeff
SIG: HUP
--- End Message ---
--- Begin Message ---
On Sunday 01 December 2002 04:43, Jeffrey B.Ferland wrote:
> For reference, see http://autocracy.homelinux.org/template.php and
> http://autocracy.homelinux.org/error.php
Unless you have a good reason to do otherwise please post your code here.
People would be less inclined to help if they have to go about clicking on
links to see what your problem is.
> template.php is the proper layout, and uses the same code as
> error.php, with the exception that "LEFT SIDE TEXT" has been replaced with
> 'list_writings(poetry)'. Note that the output from that function occurs
> where it was placed within the code, not where it was called to...
>
1) Do you really mean list_writings(poetry), or did you in fact mean
list_writings($poetry)?
> Basically, instead of the output from list_writings(poetry) being passed to
> the function, it simply executes.
2) How did you conclude that? Did you check that
list_writings(poetry)/list_writings($poetry) gives the correct result? IE
echo list_writings(poetry)/list_writings($poetry) ?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"You who hate the Jews so, why did you adopt their religion?"
-- Friedrich Nietzsche, addressing anti-semitic Christians
*/
--- End Message ---
--- Begin Message ---
Hi all,
I have a directory of files which are split up into sections based on
'full', 'summary' and 'competitions'. This is shown in the filename as
follows:
ministry-full-6122002.inc
I want to be able to search thru the dir looking for all the 'full'
files, then sorting them by date and including them in my html page in
date order.
I am stuck however on how to get the relevant files, can anybody help
me?
Regards, Ian.
--- End Message ---
--- Begin Message ---
Hi all,
I have a directory of files which are split up into sections based on
'full', 'summary' and 'competitions'. This is shown in the filename as
follows:
ministry-full-6122002.inc
I want to be able to search thru the dir looking for all the 'full'
files, then sorting them by date and including them in my html page in
date order.
I am stuck however on how to get the relevant files, can anybody help
me?
Regards, Ian.
--- End Message ---
--- Begin Message ---
On Sat, 30 Nov 2002, Randum Ian wrote:
> I have a directory of files which are split up into sections based on
> 'full', 'summary' and 'competitions'. This is shown in the filename as
> follows:
>
> ministry-full-6122002.inc
>
> I want to be able to search thru the dir looking for all the 'full'
> files, then sorting them by date and including them in my html page in
> date order.
To get an array full of the file names you want:
$interestingFiles = array();
$dir = opendir( "/path/to/directory" ) or die( "Could not open dir" );
while( $dirEntry = readdir( $dir ) ){
if( ereg( "full", $dirEntry) ){
array_push( $interestingFiles, $dirEntry );
}
}
I'll leave it up to you to sort $interestingFiles by the date in the
element values, since I don't recognize a date in your file-naming
convention.
g.luck,
~Chris
--- End Message ---
--- Begin Message ---
Thanks a lot Chris that was a great help.
The date is in the last part of the filename. In the example I have
posted below:
Ministry is the name of the club.
Full is the type of the content.
6122002 is the date - It is in the form ddmmyyyy so the example here is
6th December 2002.
Is there a simple way I can just grab the date and sort it by order?
Should I change the format of the date to make it easier or something?
-----Original Message-----
From: Chris Wesley [mailto:[EMAIL PROTECTED]]
Sent: 30 November 2002 20:25
To: [EMAIL PROTECTED]
Cc: Randum Ian
Subject: Re: [PHP] Read Files
On Sat, 30 Nov 2002, Randum Ian wrote:
> I have a directory of files which are split up into sections based on
> 'full', 'summary' and 'competitions'. This is shown in the filename as
> follows:
>
> ministry-full-6122002.inc
>
> I want to be able to search thru the dir looking for all the 'full'
> files, then sorting them by date and including them in my html page in
> date order.
To get an array full of the file names you want:
$interestingFiles = array();
$dir = opendir( "/path/to/directory" ) or die( "Could not open dir" );
while( $dirEntry = readdir( $dir ) ){
if( ereg( "full", $dirEntry) ){
array_push( $interestingFiles, $dirEntry );
}
}
I'll leave it up to you to sort $interestingFiles by the date in the
element values, since I don't recognize a date in your file-naming
convention.
g.luck,
~Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Would it just be easier to do it by file last modified date then?
-----Original Message-----
From: Jeffrey B.Ferland [mailto:[EMAIL PROTECTED]]
Sent: 30 November 2002 21:57
To: Randum Ian
Subject: Re: [PHP] Read Files
On Saturday 30 November 2002 04:47 pm, you wrote:
> Thanks a lot Chris that was a great help.
>
> The date is in the last part of the filename. In the example I have
> posted below:
>
> Ministry is the name of the club.
> Full is the type of the content.
> 6122002 is the date - It is in the form ddmmyyyy so the example here
is
> 6th December 2002.
Date format is best set as YYYY-MM-DD, but most importantly having
leading
0's. Ministry as in Ministry of Sounds?
> Is there a simple way I can just grab the date and sort it by order?
> Should I change the format of the date to make it easier or something?
Anyway, the easiest thing I can think of is to run a regex enumerating
all
the files that are marked "full" and then sorting them from there by
regexing
out the different dates. Even then, it'll take a good deal of coding...
-Jeff
SIG: HUP
--- End Message ---
--- Begin Message ---
I am trying to compile PHP 4.3RC2 and enable the domxml
library but when I compile PHP it doesn't seem to work?
./configure --with-xml --with-domxml
Any ideas?
--- End Message ---