logging IP address

nodoubts2k

Golden Member
Sep 7, 2003
1,531
1
71
I have a section of my website that allows users to upload files. I would like to have the persons IP logged when they upload a file, as well as the name of the file that they upload.

The upload script is very simple,


Any help would be greatly appreicated.

Also, I dont really know much about mysql or anything. For the logging it could even be in notepad or something.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
If you're dealing with text files you want to be pretty careful. In a multi-threaded environment just opening up common text files isn't a great idea. (Granted file upload doesn't happen all that often so you're probably safe). A better solution might be writing logs to your database (if you have one) or checking out the openlog and syslog functions. Of course those would require some configuration to get them to work properly, I don't know how easy or manageable that would be.
 

Modeps

Lifer
Oct 24, 2000
17,254
44
91
Originally posted by: kamper
If you're dealing with text files you want to be pretty careful. In a multi-threaded environment just opening up common text files isn't a great idea. (Granted file upload doesn't happen all that often so you're probably safe). A better solution might be writing logs to your database (if you have one) or checking out the openlog and syslog functions. Of course those would require some configuration to get them to work properly, I don't know how easy or manageable that would be.

Teh Winnar! Store them in a mysql database instead.
 

nodoubts2k

Golden Member
Sep 7, 2003
1,531
1
71
Originally posted by: Modeps
Originally posted by: kamper
If you're dealing with text files you want to be pretty careful. In a multi-threaded environment just opening up common text files isn't a great idea. (Granted file upload doesn't happen all that often so you're probably safe). A better solution might be writing logs to your database (if you have one) or checking out the openlog and syslog functions. Of course those would require some configuration to get them to work properly, I don't know how easy or manageable that would be.

Teh Winnar! Store them in a mysql database instead.

I know absolutely nothing about mysql. Is there somewhere that tells me how to do this?
 

nodoubts2k

Golden Member
Sep 7, 2003
1,531
1
71
Originally posted by: amdfanboy
Simple text file logging

I get the error "Parse error: parse error, unexpected T_STRING in /homepages/32/d88496332/htdocs/files/upload.php on line 10". I modified the original code so it writes in the main directory,