Ver Mensaje Individual
  #11 (permalink)  
Antiguo 03/02/2013, 11:13
Avatar de Capimaster
Capimaster
 
Fecha de Ingreso: agosto-2004
Mensajes: 494
Antigüedad: 19 años, 8 meses
Puntos: 2
Respuesta: Contador de visitas php y mysql

no lo he terminado de probar.. pero creo ke me funciona bien....

Código PHP:
Ver original
  1. if(preg_match('/^FacebookExternalHit\/.*?/i',$_SERVER['HTTP_USER_AGENT'])){  
  2. } else {
  3. if ($row_hits['ip'] != $_SERVER['REMOTE_ADDR'])
  4. {
  5. if ($totalRows_hits == 0) {
  6. mysql_select_db($database_noticias, $noticias);
  7. mysql_query("INSERT INTO hits (galeria, ip, hits) VALUES ('".$row_Recordset1['galeria']."', '".$_SERVER['REMOTE_ADDR']."', '1')", $noticias);
  8. }else{
  9. mysql_select_db($database_noticias, $noticias);
  10. mysql_query("UPDATE hits SET hits=hits+1, ip='".$_SERVER['REMOTE_ADDR']."' WHERE galeria='".$row_Recordset1['galeria']."'",$noticias);
  11. }
  12. }
  13.  }
__________________
http://www.elcapitolio.com.mx - Ocotlán, Jalisco, México