Ver Mensaje Individual
  #9 (permalink)  
Antiguo 24/06/2008, 08:06
josemv
 
Fecha de Ingreso: agosto-2003
Mensajes: 258
Antigüedad: 20 años, 8 meses
Puntos: 3
Respuesta: Filtrar visitantes por paises

una búsqueda rápida en Google muestra esta página:
http://www.phptutorial.info/iptocountry/the_script.html

y con un par de líneas puede ser algo parecido a esto:

<?php
$countryCode=iptocountry("101.102.103.104");

if($countryCode=='es'){
header('Location: http://www.misitio.com/spain.php');
exit;
}elseif($countryCode=='fr'){
header('Location: http://www.misitio.com/france.php');
exit;
}else{
header('Location: http://www.misitio.com/');
exit;
}

function iptocountry($ip) {
$numbers = preg_split( "/\./", $ip);
include("ip_files/".$numbers[0].".php");
$code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);
foreach($ranges as $key => $value){
if($key<=$code){
if($ranges[$key][0]>=$code){$country=$ranges[$key][1];break;}
}
}
if ($country==""){$country="unkown";}
return $country;
}
?>

Suerte con la tarea
Jose

[email protected]
__________________
1234web.net
El hosting para tu web
ElSuper.com Desarrollo, diseño, ingeniería, administración