tony5429 Posted August 4, 2006 Share Posted August 4, 2006 [code]<?php $ip = GetHostByName($_SERVER['REMOTE_ADDR']);?>[/code]^There's the script. I want to get the IP address of the visitor to the page, however, I keep getting the local IP address of the server itself (192.168.3.1). I've used gethostbyname() a million times before on apache with no problem, but right now i'm using IIS (the devil) and its just not working. any ideas, anyone? Quote Link to comment Share on other sites More sharing options...
AV1611 Posted August 4, 2006 Share Posted August 4, 2006 well, did they come direct to that page or did they come through another page/portal? I have the same issue: If they login first, they are coming from the server already...Make sense? Quote Link to comment Share on other sites More sharing options...
tony5429 Posted August 4, 2006 Author Share Posted August 4, 2006 Well the default document is set as index.php so when the user types the domain name, i would assume he/she goes directly to the index.php (the script I posted above). of course, iis is m$ so there is prolly some hidden security page or something that is screwing me over. Is there any other way for PHP to get the IP address of the visitor? Quote Link to comment Share on other sites More sharing options...
tony5429 Posted August 4, 2006 Author Share Posted August 4, 2006 I guess that's the only way to do it... Quote Link to comment Share on other sites More sharing options...
Salis Posted August 4, 2006 Share Posted August 4, 2006 [quote author=tony5429 link=topic=102980.msg409547#msg409547 date=1154702374][code]<?php $ip = GetHostByName($_SERVER['REMOTE_ADDR']);?>[/code]^There's the script. I want to get the IP address of the visitor to the page, however, I keep getting the local IP address of the server itself (192.168.3.1). I've used gethostbyname() a million times before on apache with no problem, but right now i'm using IIS (the devil) and its just not working. any ideas, anyone?[/quote]Actually if you want just the visitors IP then try:$ip = $_SERVER['REMOTE_ADDR']; Quote Link to comment Share on other sites More sharing options...
king arthur Posted August 4, 2006 Share Posted August 4, 2006 [quote author=tony5429 link=topic=102980.msg409547#msg409547 date=1154702374][code]<?php $ip = GetHostByName($_SERVER['REMOTE_ADDR']);?>[/code]^There's the script. I want to get the IP address of the visitor to the page, however, I keep getting the local IP address of the server itself (192.168.3.1). I've used gethostbyname() a million times before on apache with no problem, but right now i'm using IIS (the devil) and its just not working. any ideas, anyone?[/quote]If it's actually the hostname you want, use gethostbyaddr($_SERVER["REMOTE_ADDR"]); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.