| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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 02:01 AM.
|
| |
| | #4 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Something like this? ![]() PHP Code: |
| |
| | #5 (permalink) | ||||
| NamePros Member Join Date: Jan 2005 Location: Texas USA
Posts: 71
![]() |
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 08:46 AM.
| ||||
| |
| | #6 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,526
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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.
__________________ WP Theme Developer Your One-stop for Premium Magazine/CMS WordPress Themes Deluxe Themes |
| |
| | #7 (permalink) |
| NamePros Regular Join Date: Mar 2005
Posts: 912
![]() ![]() ![]() ![]() ![]() | Hi doc, $fp = fopen("filename.log","a+"); //Creates a File to Append $rUser = $_SERVER['REMOTE_ADDR']; // User(s) Ip address ????: NamePros.com http://www.namepros.com/showthread.php?t=114299 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 Online TV || Tech Blog Web Design & Web Development Services || Reliable Web Hosting |
| |
![]() |
| 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 10:46 PM |
| 2 Huge Name Forsale | Vegas Entertainment | Domains For Sale - Make Offer | 9 | 09-21-2004 03:37 PM |
| Tutorial: Creating a simple cgi hit counter for your site using Perl | deadserious | Webmaster Tutorials | 3 | 05-29-2004 02:31 AM |
| Opening a text file and displaying the results in browser with PHP, Perl, and Python | deadserious | CODE | 1 | 05-15-2004 08:58 PM |
| A simple cgi hit counter for your site using Perl | deadserious | CODE | 2 | 11-07-2003 09:23 AM |