IP Loggin script with traceback

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
User avatar
M0n5terBunny
New php-forum User
New php-forum User
Posts: 9
Joined: Tue Sep 06, 2011 2:30 am

Tue Sep 06, 2011 2:35 am

Hi im new to this but i have managed to make a php script that logs the ip address of a user and what page they go on thats all good and dandy i was wondering if its possible to addon to the script so that it tells me who the IP address is such as 123.123.123.123 = example.com. any ideas? script of what i have so far is below.

$ip = $_SERVER['REMOTE_ADDR'];
$pagina = $_SERVER['REQUEST_URI'];
$datum = date("d-m-y / H:i:s");
$invoegen = $datum . " - " . $ip . " - " . $pagina . "<br />";
$fopen = fopen("ips.html", "a");
fwrite($fopen, $invoegen);
fclose($fopen);

User avatar
Nullsig
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Tue Sep 06, 2011 6:03 am

You are trying to get the domain name associated with the user's IP address?

If so you are so close here is what you need to add

Code: Select all

$userDNS = $_SERVER['REMOTE_HOST']
A couple things to keep in mind though.

1. Both 'REMOTE_ADDR' and 'REMOTE_HOST' are easily altered so I wouldn't base any security on it.
2. Most users don't access websites using their webserver so the majority of the results from REMOTE_HOST will be gibberish referring to nodes or just resolving to the IP address

User avatar
M0n5terBunny
New php-forum User
New php-forum User
Posts: 9
Joined: Tue Sep 06, 2011 2:30 am

Sat Sep 10, 2011 5:25 am

thank you

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest