Jump to content

Archived

This topic is now archived and is closed to further replies.

hackerkts

Check real external IP

Recommended Posts

Anyone of here know how to make a scripts that double check if the user is using a proxy, and it will tells the real external IP address ?

I'm not referring to
[code]$_SERVER['REMOTE_ADDR'][/code]

Let's say my real external IP is 4321.4321.4321.4321 and I'm using a proxy which is 1234.1234.1234.1234
If I just use $_SERVER['REMOTE_ADDR'] it will only tells that my IP is 1234.1234.1234.1234

Overall:
I hope it could tells the external IP even you are on a proxy.

Thanks in advance and any helps will be appreciated.

Share this post


Link to post
Share on other sites
i don't think what you want to do is possible.

Proxy Example:
User        |      Proxy      |    Server
                      <-  ->

Since php is server side, not client side you woudn't be able to get the "real" ip. (i think)

Try Javascript to get the client ip, that might work (but i'm not sure)

[code]<SCRIPT>
var ip = new java.net.InetAddress.getLocalHost();
var ipStr = new java.lang.String(ip);
document.writeln(ipStr.substring(ipStr.indexOf("/")+1));
</SCRIPT>[/code]

i'm not sure if you could insert a php variable in their so you could compare it ...

Share this post


Link to post
Share on other sites
Thanks for the reply, but I believe there's a way to do it in PHP.
Since SMF also has this feature too.

Share this post


Link to post
Share on other sites
The reason for a proxy server is to hide that information!  A proxy server sends its ip in the headers but not it's users ip.  You can see everything sent in the headers that the server recieves this way:

[code]<?php
    print_r($_SERVER);
?>[/code]

Share this post


Link to post
Share on other sites
The IP behind the IP can be found using the below.  It will only work if it is behind a proxy so remember to check first.

$_SERVER['HTTP_X_FORWARDED_FOR']

HTH

Dest

Share this post


Link to post
Share on other sites
Your subject is discussed in the user contributed notes at the bottom of this page:

http://us2.php.net/getenv

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.