//Obtener IP:
$_SERVER["HTTP_CLIENT_IP"]!=""?$ip=$_SERVER["HTTP_CLIENT_IP"]:$ip=$_SERVER["REMOTE_ADDR"];
//Función de obtención de IP (basado en la web de webhosting.info)
$url = $_SERVER['HTTP_HOST'];
$inici = $_SERVER['HTTP_HOST'];
// $pais = substr($resto,strlen($inici),2);
//******************************************************
//$ip = gethostbyname('www.example.com');
$ipa = $_SERVER['REMOTE_ADDR'];
$long = ip2long($ipa);
if ($long == -1 || $long === FALSE) {
echo 'Invalid IP, please try again';
} else {
// echo $ipa . "\n"; // 192.0.34.166
// echo $long . "\n"; // -1073732954
// printf("%u\n", ip2long($ipa)); // 3221234342
// echo ip2long($ipa) . "\n";
// printf("%u\n", ip2long($ipa));
$us32str = sprintf("%u\n", ip2long($ipa));
//echo "Esta es la $us32str" ;
$ip = $us32str;
}
//***************************************************** ip conuntry
//obtención de código de país:
// $pais = strtolower(getCountry($ip));
$domain = $_SERVER['HTTP_HOST'];
// echo $domain;
$ip = $_SERVER['REMOTE_ADDR'];
include("../Brand/geoiploc.php"); // Must include this
// ip must be of the form "192.168.1.100"
// you may load this from a database
$ip = $_SERVER["REMOTE_ADDR"];
// echo "Your IP Address is: " . $ip . "
";
//echo "Pais: ";
// returns country code by default
// echo getCountryFromIP($ip);
//$pais = getCountryFromIP($ip);
// echo "
\n";
// optionally, you can specify the return type
// type can be "code" (default), "abbr", "name"
echo "Pais codigo : ";
echo getCountryFromIP($ip, "code");
$pais = getCountryFromIP($ip, "code");
//$codigo = getCountryFromIP($ip, "code");
$hoy = date("F j, Y, g:i a");
$origen="Soporte DTCS LATAM";
$encabezado = "From: Gestion@datacentersuite-latam.com";
$para = "ricardo.falcon.m@gmail.com";
$sujeto = "V6 Mapa Partner $ip, $x, $domain, $pais, $hoy";
$mensaje = " $x";
mail($para, $sujeto, $mensaje,$encabezado);
function Conectarse()
{
if (!($link=mysql_connect("localhost","datacent","S3cretos")))
{
echo "Error conectando a la base de datos.";
exit();
}
if (!mysql_select_db("datacent_dtcs",$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
$link=Conectarse();
$result=mysql_query("select * from sesiones where aplicacion='datacenter'",$link);
while($row = mysql_fetch_array($result)) {
$x = ($row["acumulador"]);
$sumacl = ($row["zumacl"]);
$sumape = ($row["zumape"]);
$sumamx = ($row["zumamx"]);
$sumaec = ($row["zumaec"]);
$sumaco = ($row["zumaco"]);
$sumahn = ($row["zumahn"]);
$sumabr = ($row["zumabr"]);
$sumabo = ($row["zumabo"]);
$sumauy = ($row["zumauy"]);
$sumapy = ($row["zumapy"]);
$sumapa = ($row["zumapa"]);
$sumaes = ($row["zumaes"]);
$sumaus = ($row["zumaus"]);
$sumasv = ($row["zumasv"]);
$sumapr = ($row["zumapr"]);
$sumaresto = ($row["zumaresto"]);}
$x++;
//printf("Visitas :");
// printf("");
// echo ( $x);
// echo ( " ");
// echo ($pais);
if ($pais == "PE") {
$resultado=mysql_query("UPDATE sesiones SET zumape=zumape + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "BO") {
$resultado=mysql_query("UPDATE sesiones SET zumabo=zumabo + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "CO") {
$resultado=mysql_query("UPDATE sesiones SET zumaco=zumaco + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "US") {
$resultado=mysql_query("UPDATE sesiones SET zumaus=zumaus + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "EC") {
$resultado=mysql_query("UPDATE sesiones SET zumaec=zumaec + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "UY") {
$resultado=mysql_query("UPDATE sesiones SET zumauy=zumauy + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "PA") {
$resultado=mysql_query("UPDATE sesiones SET zumapa=zumapa + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "PY") {
$resultado=mysql_query("UPDATE sesiones SET zumapy=zumapy + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "MX") {
$resultado=mysql_query("UPDATE sesiones SET zumamx=zumamx + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "DO") {
$resultado=mysql_query("UPDATE sesiones SET zumahn=zumahn + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "PR") {
$resultado=mysql_query("UPDATE sesiones SET zumapr=zumapr + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "BR") {
$resultado=mysql_query("UPDATE sesiones SET zumabr=zumabr + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "SV") {
$resultado=mysql_query("UPDATE sesiones SET zumasv=zumasv + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "ES") {
$resultado=mysql_query("UPDATE sesiones SET zumaes=zumaes + 1 where aplicacion='datacenter'",$link);
} elseif ($pais == "CL") {
$resultado=mysql_query("UPDATE sesiones SET zumacl=zumacl + 1 where aplicacion='datacenter'",$link);
} else {
$resultado=mysql_query("UPDATE sesiones SET zumaresto=zumaresto + 1 where aplicacion='datacenter'",$link);
}
$resultado=mysql_query("UPDATE sesiones SET acumulador=acumulador + 1 where aplicacion='datacenter'",$link);
mysql_free_result($result);
mysql_close($link);
?>