"Super contador de Visitas en PHP"=300MB SQL+4 millones de registros+Scripts

Iniciado por graphixx, Enero 03, 2013, 10:31:08 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

El proyecto va asi:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Puedes descargar todos los archivos del proyecto aca:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login   

EL paquete incluye:





La base de datos con los rangos ip de todo el mundo la saque de:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login




Descargar la base de datos de ip mundiales de:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Aqui tambien estan compiladas como usar todas las bd gratis que hay en un solo recurso:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

las banderas animadas estan en:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Por implementar:
La idea es implementar una tabla de estadisticas como esta:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Para implementarle tambien un globo 3d tipo revolver maps, gracias a que la base de datos entrega las coordenadas cartesianas, asi:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

El codigo hasta el momento va:
Código: php

<?php
include "conexiondb.php";

$ip = $_SERVER['REMOTE_ADDR']; $separar = explode('.',$ip);
print("IP: $ip<br>");
echo "1er rango: ".$separar[0]."<br>";
echo "2do rango: ".$separar[1]."<br>";
echo "3do rango: ".$separar[2]."<br>";
echo "4to rango: ".$separar[3]."<br>";

list($a, $b, $c, $d) = $separar;

$ip2 =  (($a*256+$b)*256+$c)*256 + $d;
echo "ip cifrada:".$ip2."<br>";

$connect=Conectarse();
$ssql = "SELECT * FROM `ip_group_city` where `ip_start` <= '$ip2' order by ip_start desc limit 1";
$consulta = mysql_query($ssql,$connect);
mysql_close($connect);

if( mysql_num_rows($consulta) == 1) {
$array = mysql_fetch_array($consulta);
$_country_code = $array["country_code"];
$_country_name = $array["country_name"];
$_region_code = $array["region_code"];
$_region_name = $array["region_name"];
$_city = $array["city"];
$_latitude = $array["latitude"];
$_longitude = $array["longitude"];

echo "Codigo del Pais:".$_country_code."<br>";
echo "Nombre del Pais:".$_country_name."<br>";
echo "Codigo de region:".$_region_code."<br>";
echo "Nombre de la Region:".$_region_name."<br>";
echo "ciudad:".$_city."<br>";
echo "latitud:".$_latitude."<br>";
echo "longitud:".$_longitude."<br>";
$lstring = strtolower($_country_code);
echo "<img src=banderas_iso3166/".$lstring.".GIF border=0><br>";

mysql_free_result($consulta);
//header( "Location: bienvenido.php" );
} else {
mysql_free_result($consulta);
//header( "Location: portada.php" );
}

$nav=$_SERVER['HTTP_USER_AGENT']; // guardo en la variable el Navegador
echo "navegador: "."$nav"."<br>"; // muestro la variable con el Navegador
?>
<?php
//preg_match().
if ((preg_match('/'."Nav".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Gold".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."X11".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Mozilla".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Netscape".'/', $_SERVER["HTTP_USER_AGENT"])) AND (!preg_match('/'."MSIE".'/', $_SERVER["HTTP_USER_AGENT"])) AND (!preg_match('/'."Chrome".'/', $_SERVER["HTTP_USER_AGENT"])) AND (!preg_match('/'."Konqueror".'/', $_SERVER["HTTP_USER_AGENT"])) AND (!preg_match('/'."Firefox".'/', $_SERVER["HTTP_USER_AGENT"]))) $browser = "Netscape";
elseif(preg_match('/'."Firefox".'/', $_SERVER["HTTP_USER_AGENT"])) $browser = "FireFox";
elseif(preg_match('/'."MSIE".'/', $_SERVER["HTTP_USER_AGENT"])) $browser = "MSIE";
elseif(preg_match('/'."Chrome".'/', $_SERVER["HTTP_USER_AGENT"])) $browser = "Chrome";
elseif(preg_match('/'."Lynx".'/', $_SERVER["HTTP_USER_AGENT"])) $browser = "Lynx";
elseif(preg_match('/'."Opera".'/', $_SERVER["HTTP_USER_AGENT"])) $browser = "Opera";
elseif(preg_match('/'."WebTV".'/', $_SERVER["HTTP_USER_AGENT"])) $browser = "WebTV";
elseif(preg_match('/'."Konqueror".'/', $_SERVER["HTTP_USER_AGENT"])) $browser = "Konqueror";
elseif((preg_match('/'."bot".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Google".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Slurp".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Scooter".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Spider".'/', $_SERVER["HTTP_USER_AGENT"])) || (preg_match('/'."Infoseek".'/', $_SERVER["HTTP_USER_AGENT"]))) $browser = "Bot";
else $browser = "Other";
echo "EL navegador es: ".$browser;
?>
<center>
<?php
$url=$_SERVER['HTTP_REFERER'];
echo '<strong>'."viene de(ruta completa): ".'</strong>'.$_SERVER['HTTP_REFERER'].'<br />';

preg_match( '@^(?:http://)?([^/]+)@i', $_SERVER['HTTP_REFERER'], $matches );
$host = $matches[1];

echo '<strong>'."viene de(dominio): ".'</strong>'.$host;
?>
</center>
<center>
<?php
function get_search($referer)
{
preg_match("/q=(.*?)&/", $referer, $a);
$b = urldecode(str_replace("+"," ", $a[1]));
return $b;
}


if(stristr($_SERVER['HTTP_REFERER'],'google')){
print '<strong>la busqueda de:</strong> '.get_search($_SERVER['HTTP_REFERER']);
print ' <strong>te ha traido hasta este sitio.</strong>';
}
?>
</center>
<?PHP
// example of basic use

// set directory path to where the ip2countryphp.sql.php file is
// this MUST be a relative path and MUST include the end slash /
define("BASEDIR","./");

// set width of flag, height is proportional to width.
$flag_width = "30";

// include the class file
include(BASEDIR."ip2countryphp.sql.php");

/*
Below is a heredoc example of how you might display the users info,
of course you can include only the variables you want to, or you might
want to store the ip address, 2 letter country code(for flag image) and
country name in a database for using on a specific page.
*/
$gifflag = "banderas/".$country_name.".GIF";
print <<<TEST
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Visit Site Counter</title>
</head>
<body style="font:normal 9pt tahoma,arial,verdana">
<table style="margin-top:20px;border:#CCCCCC 1px solid" width="320" cellspacing="2" cellpadding="3" border="0" align="center">
  <tr><td bgcolor="#CCCCCC" colspan="2">&nbsp;<font color="white">Visit Site Counter</font></td></tr>
  <tr><td width="200" height="26">Direccion IP:</td><td>$ip_address</td></tr>
  <tr><td>Nombre del Pais:</td><td>$country_name</td></tr>
  <tr><td>Codigo de 2 letras:</td><td>$two_letter_code</td></tr>
  <tr><td>Codigo de 3 letras:</td><td>$three_letter_code</td></tr>
  <tr><td>Bandera del Pais:</td><td><img src="$flag_img" width="$flag_width" border="0"></td></tr>
  <tr><td>Bandera del Pais:</td><td><img src="$gifflag" border="0"></td></tr>
  <tr><td bgcolor="#CCCCCC" colspan="2"><font color="white" size="1">www.eventosysistemas.com</font></td></tr>
</table>
</body>
</html>
TEST;
exit;
?>


Añadido al proyecto la libreria para dibujar en un mapa global las visitas:
GIS mapping in PHP: Part 1
Plotting a longitude / latitude coordinate on a raster map of the world using PHP and GD.
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
GIS mapping in PHP: Part 2
Loading vector data in from a Mapinfo MIF file and displaying it in an image using PHP and GD.
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
GIS mapping in PHP: Part 3
Retrieving user selected longitude and latitude coordinates from a raster map of the world.
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login
GIS mapping in PHP: Part 4
Stepping back in time, we show how to plot more than one point on a raster map of the world, loading data from a simple text file.
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login




proyecto logrado gracias a:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login

Para tornar el mapa 3d usar:
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login



Pido ayuda con esto:

COdigo del referer:
Código: text
<?php
$url=$_SERVER['HTTP_REFERER'];
echo '<strong>'."viene de(ruta completa): ".'</strong>'.$_SERVER['HTTP_REFERER'].'<br />';

preg_match( '@^(?:http://)?([^/]+)@i', $_SERVER['HTTP_REFERER'], $matches );
$host = $matches[1];

echo '<strong>'."viene de(dominio): ".'</strong>'.$host;
?>

Alguien sabe como optener hacia que pagina parte el usuario?, el contrario de HTTP_REFERER....?
Mi Blog Personal
You are not allowed to view links. You are not allowed to view links. Register or Login or You are not allowed to view links. Register or Login