Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
proxy/ip detection script
#1



Code:
<?php
$reqhost = $_SERVER['HTTP_HOST'];
$proxy = $_SERVER['HTTP_X_FORWARDED_FOR'];
$ipaddr = $_SERVER['REMOTE_ADDR'];
$revdns = $_SERVER['REMOTE_HOST'];
$final = "";
if ($revdns) {$final = $revdns;}
else {$final = $ipaddr;}
if ($proxy) {
       $final = $proxy;
       $prxyhost = gethostbyaddr($_SERVER['HTTP_X_FORWARDED_FOR']);
       if ($prxyhost) {$final = $prxyhost;}
       }
echo"your ip/revdns is $final";
?>




 

this little script will check if there's a proxy by checking if there is a X_FORWARDED_FOR in the header (which contains the client's ip) and will try to get the reverse dns of that ip, if there's no revdns, it prints the ip, if there's no X_FORWARDED_FOR, it will try to get the reverse dns of the remote ip (REMOTE_HOST), if there's no revdns, it will print the ip (REMOTE_ADDR).

Reply
#2
awesome! I was looking for that..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)