Results 1 to 6 of 6
Thread: Display IP address in php?
-
09-18-2003, 02:36 AM #1Local tech for Los Angeles
- Join Date
- Feb 2003
- Location
- Panorama City, CA
- Posts
- 2,581
Display IP address in php?
i couldnt find a scritp that is all ready made? do any u know 1 or use 1? java is ok will me to if u know 1.
o and i mean the client pc the "surfer" of the webLast edited by Jeremy; 09-18-2003 at 02:47 AM.
-
09-18-2003, 02:49 AM #2Junior Guru Wannabe
- Join Date
- Mar 2002
- Location
- PDX
- Posts
- 81
http://www.google.com/search?hl=en&i...lay+ip+address
or
it's easy to do it in php, just print $_SERVER["REMOTE_ADDR"]
Hope that helps!
-
09-18-2003, 02:53 AM #3Junior Guru Wannabe
- Join Date
- Mar 2002
- Location
- PDX
- Posts
- 81
all ready made
Code:<html> <head> </head> <body> <?php echo $_SERVER["REMOTE_ADDR"]; ?> </body> </html>
-
09-18-2003, 08:53 AM #4Web Hosting Master
- Join Date
- Dec 2002
- Location
- England
- Posts
- 726
But remember this will not always give you the actual users, if for instance they are using a proxy you will get the proxy ip not the user, although some proxies wil forward the information which can be picked up with $_SERVER['HTTP_X_FORWARDED'], but even then I don't think you can can get the IP of AOL users for example, because AOL uses caching.
-
09-18-2003, 09:56 AM #5Retired Moderator
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 4,721
PHP Code:if (getenv('HTTP_X_FORWARDED_FOR'))
{
$ip=getenv('HTTP_X_FORWARDED_FOR');
}
else
{
$ip=getenv('REMOTE_ADDR');
}
Hyperconfused (™)
-
09-18-2003, 11:33 AM #6Local tech for Los Angeles
- Join Date
- Feb 2003
- Location
- Panorama City, CA
- Posts
- 2,581
ahhhh sweet thx all. i tryied to make 1 my self "script" learning at valley college it looks so simple and yet i get brain dead..
i think i better stick to my networking class
thx u again