Chat LIVE With Programming Experts! There Are 23 Online Right Now...

 

Code Snippets

  

PHP Source Code


Welcome to Dream.In.Code
Become a PHP Expert!

Join 244,187 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,329 people online right now. Registration is fast and FREE... Join Now!





IP Logger

Logs IP's of page visitors, and saves to a log HTML file. IP's are anchored to dnsstuff.org's City from IP page.

Submitted By: tel0r
Actions:
Rating:
Views: 31,119

Language: PHP

Last Modified: May 13, 2005
Instructions: Can be used within a current page, or added to a site via an IFrame. (maybe other ways to implement too?)

Auto Creates log.html,if file does not exist.

Snippet


  1. <?php
  2. $logfile= '/full_path_to/log.html';
  3. $IP = $_SERVER['REMOTE_ADDR'];
  4. $logdetailsdate("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>';
  5. $fp = fopen($logfile, "a");
  6. fwrite($fp, $logdetails);
  7. fwrite($fp, "<br>");
  8. fclose($fp);
  9. ?> 

Copy & Paste


Comments


realwish 2009-01-14 14:34:53

i am unable to run,i had just pasted this content and saved as a.php. but nothing is happning

pr4y 2009-02-17 03:15:13

@ realwish... have you set proper CHMOD / file access rights to the HTML file? Check that then let me know.


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month