Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

storing website visitor information in txt file 3

Status
Not open for further replies.

rossmcl

Programmer
Apr 18, 2000
128
Hello.

I want to store information on visitors coming to my website using PHP. (my website is FLASH-based)
I unfortunately do not have mySQL, therefore I need to store the information in a text file. (wrong way to do it I know, but I cannot use mySQL for other reasons.

1) is this possible to do it using txt file
2) how?!?!?

I am very new to Flash, and even newer to PHP, so have no clue what are the variables I can get with PHP.

Essentially, at a minimum I want to store

a) date visited
b) machine IP visited from
c) logged in username from NT/XP if possible
d) any other useful unique information I can get about the website visitor

Is this possible?

Thanks
RM
 
If you're only writing to the file, then a text file is not necessarily a bad idea. Appending to a file is a fairly simple operation in PHP. Using a file like a database (writing and reading values) can be problematic.


PHP's date() function ( can return a date in any format you might need.

The other information will be available in PHP's predefined superglobal array, $_SERVER ( with the possible exception of the NT/XP logged-in username.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Here's what I use on some pages...

Simply create a blank text file (log.csv), upload to your server, and set the permissions so that it can be written to by the server (CHMOD 755).

Code:
//LOG USER
$date = date("ymd-Hi");
$LogFile = "log.csv";
$FilePointer = fopen ($LogFile, "a");
fwrite ($FilePointer, "\"$date\",\"$REMOTE_ADDR\",\"$HTTP_REFERER\"\n");
fclose ($FilePointer);
//END LOG USER

This records the date & time, the user's IP address and what page they came from.

- - picklefish - -
Why is everyone in this forum responding to me as picklefish?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top