Consultando con mi camaradas rusos, uno de ellos dio el sgte codigo:
Código PHP:
$time1=time();
$time2=time();
if (!$user[$REMOTE_ADDR]) {//si no hay ese IP, lo insertamos
$pol=mysql_query("INSERT into table values('','$user','$time1','')");
setcookie("users", $user);
$auth="OK";
}
$out = mysql_query("SELECT id,user,time FROM table WHERE user='".$_COOKIE['users']."'");
if (mysql_num_rows($out) == 1) {
$auth="OK";
echo "el usuario esta!";
}
if($auth=""){
echo "se fue!";
//registramos la hora de salida
$pol=mysql_query("INSERT into table values('','$user','$time1','$time2') WHERE user='".$_COOKIE['users']. "' ");
}
Este
script usa cookies!