7 Replies - 2246 Views - Last Post: 24 March 2011 - 04:06 PM

#1 tel0r  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 27
  • Joined: 22-February 05

IP Logger

Posted 13 May 2005 - 08:27 AM

Description: 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.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.
<?php
$logfile= '/full_path_to/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, "
");
fclose($fp); 
?> 


Is This A Good Question/Topic? 0
  • +

Replies To: IP Logger

#2 realwish  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 47
  • Joined: 29-January 08

Re: IP Logger

Posted 14 January 2009 - 12:34 PM

i am unable to run,i had just pasted this content and saved as a.php. but nothing is happning
Was This Post Helpful? 0
  • +
  • -

#3 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: IP Logger

Posted 17 February 2009 - 01:15 AM

@ realwish... have you set proper CHMOD / file access rights to the HTML file? Check that then let me know.
Was This Post Helpful? 0
  • +
  • -

#4 frankthomassen  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 08-October 09

Re: IP Logger

Posted 08 October 2009 - 01:15 PM

You may try this one: All features you need and it works: http://www.debilsoft.de
Was This Post Helpful? 0
  • +
  • -

#5 jamied_uk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 11-April 10

Re: IP Logger

Posted 13 April 2010 - 04:55 AM

nice ty
Was This Post Helpful? 0
  • +
  • -

#6 Denis1  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 32
  • View blog
  • Posts: 104
  • Joined: 29-July 09

Re: IP Logger

Posted 02 August 2010 - 05:38 AM

what is the $IP for? on line 3
Was This Post Helpful? 0
  • +
  • -

#7 alwynwan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 28-January 11

Re: IP Logger

Posted 28 January 2011 - 05:30 PM

@Denis1 i think it's declaring the variable $IP as '$_SERVER['REMOTE_ADDR']', which is the client computer's ip address. maybe so then in the log.html file it will be able to print out something like: IP: 127.0.0.1 or whatever
Was This Post Helpful? 0
  • +
  • -

#8 grimpirate  Icon User is offline

  • Pirate King
  • member icon

Reputation: 149
  • View blog
  • Posts: 717
  • Joined: 03-August 06

Re: IP Logger

Posted 24 March 2011 - 04:06 PM

The $IP variable does nothing. It's likely a typographical error. The author was probably trying to convey that ip addresses are retrieved from $_SERVER['REMOTE_ADDR']. He could've done this in a comment though. Something to remember is that this ip logger script will NOT empirically log every ip address. If a person accesses the site while the logfile is currently being written to the process will fail and the ip address will not be recorded.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1