
09/10/2009, 08:51
|
| | Fecha de Ingreso: junio-2008
Mensajes: 30
Antigüedad: 16 años, 8 meses Puntos: 0 | |
Respuesta: Mostrar usuarios registrados logueados Haciendole caso al amigo de arriba, encontre un code...
<?
//online
$server = "YOUR HOST"; // usually localhost
$db_user = "USERNAME";
$db_pass = "PASSWORD";
$database = "DATABASE";
$timeoutseconds = 300; // length of gaps in the count
//get the time
$timestamp = time();
$timeout = $timestamp-$timeoutseconds;
//connect to database
mysql_connect($server, $db_user, $db_pass);
//insert the values
$insert = mysql_db_query($database, "INSERT INTO useronline VALUES
('$timestamp','$REMOTE_ADDR','$PHP_SELF')");
if(!($insert)) {
print "";
}
//delete values when they leave
$delete = mysql_db_query($database, "DELETE FROM useronline WHERE timestamp<$timeout");
if(!($delete)) {
print "";
}
//grab the results
$result = mysql_db_query($database, "SELECT DISTINCT ip FROM useronline WHERE file='$PHP_SELF'");
if(!($result)) {
print "";
}
//number of rows = the number of people online
$user = mysql_num_rows($result);
if(!($user)) {
print("ERROR: " . mysql_error() . "\n");
}
//spit out the results
mysql_close();
print("$user");
?>
Voy a testearlo. |