| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Barru. | Creating a file In PHP whenever someone uploads a file I want it to create a [filename.fileextension].log file that stores the IP of the person who uploaded it, I have a getip function but dont know how to create the file. PHP Code: PHP Code:
__________________ Last edited by Mikor; 08-10-2005 at 01:01 AM. |
| |
| | #3 (permalink) |
| DNOA Member | I'd recommend storing these kinds of things in a database - the IP in the DB (lol sounds wierd) that references the file.
__________________ codeboards A high-quality community of programmers -- Join today and post! We want new members! |
| |
| | #5 (permalink) | |
| NamePros Member | Quote:
I would suggest something like secondversion is doing, but also add the filename to the log. To add anything else, just add another piece to the array ex: PHP Code:
__________________ I wonder... Last edited by Outer; 08-10-2005 at 07:46 AM. | |
| |
| | #6 (permalink) |
| Senior Member | Are you going to have a file for each visitor unique IP? weird. If you already use mySQL to store user info, you could just add another field for IP and set it at the time of registration.
__________________ Custom WordPress theme design. Top notch free WordPress themes Custom Theme Design |
| |
| | #7 (permalink) |
| NamePros Regular | Hi doc, $fp = fopen("filename.log","a+"); //Creates a File to Append $rUser = $_SERVER['REMOTE_ADDR']; // User(s) Ip address if(!$fp){ // Check to see if the File print ("Could Not Create File."); // was Created if not exit exit; //else continue loading instructions } fwrite($fp,$rUser,strlen($rUser)); // Write The User Ip Address if(fclose($fp)){ print ("File Closed"); //Check the file was closed not } //necessary but encouraged.
__________________ Live Support : Zubair11 [at] hotmail.com Free SEO Directory! || Free Games and Songs || eBloggy.net Zubair.info || Mixcat Interactive |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: How to Install Apache2 MySQL and PHP on Windows | deadserious | Webmaster Tutorials | 35 | 09-21-2005 09:46 PM |
| Tutorial: Creating a simple cgi hit counter for your site using Perl | deadserious | Webmaster Tutorials | 3 | 05-29-2004 01:31 AM |
| Opening a text file and displaying the results in browser with PHP, Perl, and Python | deadserious | CODE | 1 | 05-15-2004 07:58 PM |
| A simple cgi hit counter for your site using Perl | deadserious | CODE | 2 | 11-07-2003 08:23 AM |