![]() |
|
|
#1
|
||
|
Hi all,
Here is the code to find the real IP address if someone has gone through a proxy server: Code:
function get_real_ip()
{
$ip = false;
if(!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ips = explode(", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
if($ip)
{
array_unshift($ips, $ip);
$ip = false;
}
for($i = 0; $i < count($ips); $i++)
{
if(!preg_match("/^(10|172\.16|192\.168)\./i", $ips[$i]))
{
if(version_compare(phpversion(), "5.0.0", ">="))
{
if(ip2long($ips[$i]) != false)
{
$ip = $ips[$i];
break;
}
}
else
{
if(ip2long($ips[$i]) != - 1)
{
$ip = $ips[$i];
break;
}
}
}
}
}
return ($ip ? $ip : $_SERVER['REMOTE_ADDR']);
}
__________________
|
|
|
|
||
|
#2
|
||
|
Thats cool, didn't know there was a way to do that. Thanks!
![]()
__________________
WebDevTalk - Revenue Sharing Webmaster Discussion Forums |
|
|
|
||
|
#3
|
||
|
Sorry to bump, but thanks, this will help me out, and a friend was recently looking for it
Not sure if he got it yet ![]() |
|
|
|
||
|
#4
|
||
|
Ooo thans so much
I was looking for it ![]() |
|
|
|
||
|
#5
|
||
|
I hardly believe that this is working. And I 99% guarantee that it doesn't. Anonymous proxies can be cought only by some kind of filter.
|
|
|
|
||
|
#6
|
||
|
oh man tjanks very much..i didnot believe that it would work,,,but it worked,,thanks very much
__________________
Hacks | Tech Tips |
|
|
|
||
|
#7
|
||
|
Does it really work with proxies that are actually a little more protected ? ;D
__________________
stewart:howe Web Developer & Programmer Vilario.com | Celermedia.com |
|
|
|
||
|
#8
|
||
|
Oh thanks let me check it and post the comment
|
|
|
|
||
|
#9
|
||
|
Nice simple code mate. This could help lots of sites that ban people but they come back with proxies etc.
Cheers. |
|
|
|
||
|
#10
|
||
|
Very cool! Very useful, also. Cheers, mate.
|
|
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Know how DNS Work. | blackwizard | Domain Name Forum | 0 | 10-02-2006 10:29 |
| How can you find a targeted user`s ip in cpanel | hell-knight | Web Hosting Tutorials | 1 | 06-12-2006 17:01 |
| Whois-it.com | Free whois, IP lookup, ping tools and more! | redz | Other Free Resources | 0 | 01-13-2006 21:16 |
| IP Deny Manager | asp | Web Hosting Forum | 0 | 06-04-2005 23:07 |
| How do I block an IP address using Cpanel? | asp | Web Hosting Forum | 0 | 06-04-2005 21:44 |