PHP Code:
$unregisteredhost=@gethostbyaddr($ipaddress);
if (strlen($unregisteredhost)>1 AND $postusername=='Unregistered')
{
$host_arr=explode(".", $unregisteredhost);
$count=count($host_arr);
if($count > 1)
{
if(intval($host_arr[$count-1])!=0)
{$unregisteredhost2=substr($unregisteredhost,0,strrpos($unregisteredhost,".")).".*";}
else{$unregisteredhost2 = "*".strstr($unregisteredhost, ".");}
}
else {$unregisteredhost2=$unregisteredhost;}
$postusername=$unregisteredhost2;
}
else if ($ipaddress AND $postusername=='Unregistered')
{
$postusername=$ipaddress;
}