Ip Logger
Moderator: General Moderators
Ip Logger
Any of you know how I could make an Ip Logger that will log the Ip's Into a php file that will only let me view the ip's? Because im Making it echo into a admin panel page and if they dont have my ip then it will give them an error saying Your not an admin.
- evilmonkey
- Forum Regular
- Posts: 823
- Joined: Sun Oct 06, 2002 1:24 pm
- Location: Toronto, Canada
well one thing you could do if you have user logins is set a usergroup, and set one to admin. If you're an admin, it will admit you, otherwise tell you something like access denied.
As for the logger itself, all you gotta do is write the line $REMOTE_ADDR to a file with write permissions (777). Not that hard.
Good luck.
As for the logger itself, all you gotta do is write the line $REMOTE_ADDR to a file with write permissions (777). Not that hard.
Good luck.
Heres some useful logging variables
Code: Select all
$currentPage = @$_REQUEST['currentPage'];
$ip = getenv("REMOTE_ADDR");
$host = @GetHostByAddr($ip);
$real_host=chop($host);
if($real_host)
{$host_arr=explode(".", $real_host);
$count=count($host_arr);
if($count > 1)
{if(intval($host_arr[$count-1])!=0)
{$host=substr($real_host,0,strrpos($real_host,".")).".*";}
else
{$host = "*".strstr($real_host, ".");}}
else
{$host=$real_host;}}
else
{$host="";}
$browser = $HTTP_USER_AGENT;
$referer = getenv("HTTP_REFERER");
$qstring = $QUERY_STRING;