$SCRIPT_NAME Problem
| From: | Brad Harriger | Date: | Tue, 24 Sep 2002 19:17:45 +0000 |
| Subject: | $SCRIPT_NAME Problem | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15980@lists.php.net to get a copy of this message | ||
I'm trying to create a simple script that logs access to several pages on a site I'm working on. I want to capture the date and time, address of the PC accessing the page, and the name of the script being accessed. I have the following code:
<?php
$today = date("F j, Y H:i:s");
$lineOut = $REMOTE_ADDR;
$lineOut .= " ";
$lineOut .= $today;
$lineOut .= " ";
$lineOut .= $SCRIPT_NAME;
$lineOut .= "\n";
$fp = fopen("logfile.txt","a");
fputs($fp,$lineOut);
fclose($fp);
?>
Everything works fine except for the line "lineOut .= $SCRIPT_NAME;" The value of $SCRIPT_NAME is always the path to the PHP executable, not the script that contains the code. How do I correct this problem. I'm running PHP 4.06 under Apache 1.3.22 on a Win 2000 PC.
Thanks in advance,
Brad