Hello
I want to find a way to obtained the ip and the hostname from the users
I want the real host name and ip address !!!!!!!!!
Can you please help me!!!
Thank you
Hello
I want to find a way to obtained the ip and the hostname from the users
I want the real host name and ip address !!!!!!!!!
Can you please help me!!!
Thank you
<?
print GetHostByName($REMOTE_ADDR);
?>
You should see your hostname...?
I know normally you'd use gethostbyaddr(); , but the situation I'm working in will have 90% of the users coming from an outside address from behind a router on various networks, all using 192.86.... addresses. I Need to be able to grab the top level domain for these users
thank you
Geia sou Spyro!
If your users hide behind proxies there is not much you can do. You could do a whois but even this is tricky because you have to look at the right registry.. ARIN, RIPE, APNIC, AfriNIC, LACNIC :queasy:
Geia sou altexis
Thank you very much !
<?php
# globalEnv.php
$envs = array( "HTTP_REFERER", "HTTP_USER_AGENT", "REMOTE_ADDR", "REMOTE_HOST", "QUERY_STRING", "PATH_INFO" );
if (!isset($_SERVER['REMOTE_HOST']) && isset( $_SERVER['REMOTE_ADDR'] ) )
{
$_SERVER['REMOTE_HOST'] = gethostbyaddr( $_SERVER['REMOTE_ADDR'] );
}
foreach ( $envs as $env )
{
echo "$env: $_SERVER[$env]<br />";
}
?>
<html>
<head>
<title>Global Environment Server Variables Test</title>
</head>
<body>
<?php
$self = $_SERVER['PHP_SELF'];
echo "<a href=\"http://domain.com/dir/globalEnv.php/my_path_info?action=click_this&this=$self\">globalEnv TEST LINK</a>";
?>
</body>
</html>
Hopefully this helps you along the way!
So what DeadlySin3 is saying,
$SERVER['REMOTE_HOST'] is the same as gethostbyaddr( $SERVER['REMOTE_ADDR'] ), if $SERVER['REMOTE_HOST'] is set up. no need to use gethostbyaddr( $SERVER['REMOTE_ADDR'] ).
But in some site set up, HostnameLookups is not ON, so $SERVER['REMOTE_HOST'] is not set up on these sites, when $SERVER['REMOTE_HOST'] is not set up, we use gethostbyaddr( $_SERVER['REMOTE_ADDR'] ).
Right?