Ver Mensaje Individual
  #15 (permalink)  
Antiguo 15/01/2003, 15:33
Avatar de Cain
Cain
 
Fecha de Ingreso: enero-2002
Ubicación: Catalunya
Mensajes: 6.459
Antigüedad: 22 años, 3 meses
Puntos: 17
Revisando este post encontré este código:

Código PHP:
<?
global $REMOTE_HOST$REMOTE_ADDR$HTTP_X_FORWARDED_FOR$MIRRORS;

    

    
// We do not know the country

    
$country '';



    
// Figure out IP address and hostname

    
$ipaddr $HTTP_X_FORWARDED_FOR $HTTP_X_FORWARDED_FOR $REMOTE_ADDR;

    
$hostname $REMOTE_HOST;

    

    
// If we have no hostname, or if it's an IP

    // address, then try to get that hostname

    
if  (!$hostname || $hostname == $ipaddr) {

        
$hostname = @gethostbyaddr($ipaddr);

        if (
$hostname == $ipaddr) { $hostname ""; }

    }

    

    
// If we have that hostname finnaly, get the TLD

    
if ($hostname) {

        if (
ereg('([a-zA-Z]+)$'$hostname$reg)) {

            
$country $reg[0];

        }

    }
?>
Lo saqué del código de http://www.php.net
__________________
M a l d i t o F r i k i