Jump to content


Photo

Ip Display/Log Code :: PHP


  • Please log in to reply
No replies to this topic

#1 FlYiNg AcE

FlYiNg AcE
  • Members
  • 27 posts

Posted 19 January 2006 - 12:01 PM

Hay guys i thought this nifty code would help some people with IP Display and Logging them.
Link: http://fundisom.com/...tion/visitor_IP
<?php 
             echo $_SERVER['REMOTE_ADDR'];
             ?>
Link: http://www.daniweb.c...hread35565.html
<?php
              $logfile= 'log.txt';
$IP = $_SERVER['REMOTE_ADDR'];
$logdetails=  date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].' target=_blank>'.$_SERVER['REMOTE_ADDR'].'</a>';
$fp = fopen($logfile, "a");
fwrite($fp, $logdetails);
fwrite($fp, "<br>");
fclose($fp); 
?>
With the IP Log code ^ you dont have to use the extenstion .txt you can do basically nearly every file extenstion that can show you what's been logged into hte file, as for example you can log ips in a html page, Also i am still working out how to get an ip once only each session when a visitor enters a site and not get it when an visitor goes to another page,
thanks to the sites linked to as i was looking round for ages just to get it lol
Peace out! Enjoy!
FlYiNg AcE




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users