Jump to content


Photo

Check real external IP


  • Please log in to reply
6 replies to this topic

#1 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 21 July 2006 - 08:22 AM

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
$_SERVER['REMOTE_ADDR']

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.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#2 tommych

tommych
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 July 2006 - 10:12 AM

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)

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

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



#3 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 22 July 2006 - 08:45 AM

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

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#4 mainewoods

mainewoods
  • Members
  • PipPipPip
  • Advanced Member
  • 685 posts
  • LocationMaine

Posted 22 July 2006 - 02:12 PM

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:

<?php
    print_r($_SERVER);
?>



#5 Destruction

Destruction
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 22 July 2006 - 02:19 PM

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

#6 mainewoods

mainewoods
  • Members
  • PipPipPip
  • Advanced Member
  • 685 posts
  • LocationMaine

Posted 22 July 2006 - 10:12 PM

Your subject is discussed in the user contributed notes at the bottom of this page:

http://us2.php.net/getenv



#7 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 24 July 2006 - 08:19 AM

Thanks, appreciate it.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users