Visitors Log Help
| From: | Martin Clifford | Date: | Wed, 10 Apr 2002 15:36:34 +0000 |
| Subject: | Visitors Log Help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-92406@lists.php.net to get a copy of this message | ||
Hi all!
I am trying to build a Visitor_Log.txt file for my page, which will write specific information about
users that visit the page (time of day they visited, browser they are using, operating system, etc)
to a txt file on my server.
My question is... how do I write these values to the file as soon as they access the page? I'm
very comfortable with using JavaScript to get user information, but I know that PHP also has
built-in functions to get user information as well... would I do something along the lines of...
<?
$TheFile = "log.txt";
$Open = fopen($TheFile, "a");
if($Open)
{
fwrite($Open, "$HTTP_USER_AGENT\n");
fclose($Open);
}
?>
If someone loaded a page with that in it, would it write to the file as soon as it's accessed
and interpreted, or would some action have to take place to make it run? I won't ask which PHP
Variables can be used to get user information, I can find that information in the Manual... any
information as to my questions would be wonderful!
Also, please CC me on responses since I'm on the digest! Thank you in advance!
Martin