As I'm sort of new to this, can you expand on "file locking"?  As of now, I'm running 
Apache on my home PC, but my host most likely will not allow me access to it's apache 
log files.  That is the main reason I want to do this, and also because I'm studying 
PHP and this looks like a good way to get a handle on file permissions, file writing, 
reading, etc.  Thanks for answering my question though! :)


>>> "Andrew Brampton" <[EMAIL PROTECTED]> 04/10/02 11:56AM >>>
Well that should write as soon as that php is requested...

BUT U might want to put some file locking in there to make sure 2 people
don't visit at the exact same time and corrupt your Vistor_Log.txt

BTW If are using apache a better option might be to look into the custom log
files it can make, I think it can do what you are trying to do in PHP

----- Original Message -----
From: "Martin Clifford" <[EMAIL PROTECTED]>
Sent: Wednesday, April 10, 2002 4:36 PM
Subject: [PHP] Visitors Log Help

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

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");
  fwrite($Open, "$HTTP_USER_AGENT\n");


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


PHP General Mailing List (
To unsubscribe, visit: 

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to