SunQuest
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 10th, 2002, 03:13 PM
liaaam liaaam is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 9 liaaam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Loggin IP Addresses

I have been trying to find the solution to my problem but have not found where to start. My problem is I need to log the current visitors visit to the home page, including time/date stamp and their IP address. The logging needs to be done to a text file on the server.

I have no idea where to start and although my knowledge of PHP is VERY limited i know that once I have a starting point I will be able customize the code to my needs.

Liaaam

Reply With Quote
  #2  
Old August 10th, 2002, 03:38 PM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Loggin IP Addresses

well i spose the best solution would be to RTFM!

you can download the manual from www.php.net which will have all the required info. To write to a text file, you use fread, fopen fputs..look up those, for IP you use the variable $REMOTE_ADDR...

hope that was substantial pointing

Reply With Quote
  #3  
Old August 10th, 2002, 06:13 PM
cjrobs cjrobs is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Southampton, England
Posts: 121 cjrobs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to cjrobs
RE: Loggin IP Addresses

you'd want something like the following: (i have not tested this)
php Code:
Original - php Code
  1.  
  2. $fo = fopen('log.txt', 'a');
  3. $date = date("d/m/y G.i:s", time());
  4. fputs($fo, "$date - $REMOTE_ADDRn");
  5. fclose($fo);


You will need to create a text file called log.txt in the same dir as the script, and if on linux, it will need CHMOD 777.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Loggin IP Addresses


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway