Support Forums
IP Logger - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: IP Logger (/showthread.php?tid=695)



IP Logger - brett7 - 10-08-2009

This script when put on a website will write the ips of all visitors and write to log.html, it will create a link to an ip database website. Make sure you have created log.html and that you have set the permisions so it can be writen.

Code:
<?php
      $logfile= 'log.html';

      $IP = $_SERVER['REMOTE_ADDR'];

      $logdetails=  date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].'>'.$_SERVER['REMOTE_ADDR'].'</a>';
  
      $fp = fopen($logfile, "a");

      fwrite($fp, $logdetails);
  
      fwrite($fp, "<br>");
  
      fclose($fp);

      ?>



RE: IP Logger - Headshot - 10-08-2009

That's hot, I saved this. Big Grin


RE: IP Logger - MAcar - 10-08-2009

Thanks for this tut ive always wondered how to get a persons ip in php i kew how to save it but not how to retrive it thanks agian!


RE: IP Logger - brett7 - 10-09-2009

no problem


RE: IP Logger - Socrates - 10-09-2009

I'll eventually post one of these for python soon.


RE: IP Logger - HuNt3R - 10-09-2009

Nice post


RE: IP Logger - Bartdevil - 10-10-2009

Thanks for this.


RE: IP Logger - Akshay* - 10-10-2009

Thanx...for this u must get a +rep


RE: IP Logger - brett7 - 10-10-2009

thanks all Big Grin