Foros del Web » Programando para Internet » PHP »

Revisar Script de usuarios online

Estas en el tema de Revisar Script de usuarios online en el foro de PHP en Foros del Web. Hola, encontre este script, pero no lo entiendo muy bien, me gustaria me dijerais si esta bien hexo y me explicarais un pokito ke es ...
  #1 (permalink)  
Antiguo 04/02/2005, 04:15
 
Fecha de Ingreso: diciembre-2004
Mensajes: 371
Antigüedad: 19 años, 3 meses
Puntos: 0
Revisar Script de usuarios online

Hola, encontre este script, pero no lo entiendo muy bien, me gustaria me dijerais si esta bien hexo y me explicarais un pokito ke es lo ke hase y si hay ke configurar algo.
Gracias.Un saludo.



USERONLINE.PHP4
--------------------------------------------------------------------------
<?php
include ("./config.php3");

if (!$datei) $datei = dirname(__FILE__)."/$filename";
$time = @time();
$ip = $REMOTE_ADDR;
$string = "$ip|$time\n";
$a = fopen("$filename", "a+");
fputs($a, $string);
fclose($a);

$timeout = time()-(60*$timer);

$all = "";
$i = 0;
$datei = file($filename);
for ($num = 0; $num < count($datei); $num++) {
$pieces = explode("|",$datei[$num]);

if ($pieces[1] > $timeout) {
$all .= $pieces[0];
$all .= ",";
}
$i++;
}

$all = substr($all,0,strlen($all)-1);
$arraypieces = explode(",",$all);
$useronline = count(array_flip(array_flip($arraypieces)));

// display how many people where activ within $timeout
echo $useronline;

// Delete
$dell = "";
for ($numm = 0; $numm < count($datei); $numm++) {
$tiles = explode("|",$datei[$numm]);
if ($tiles[1] > $timeout) {
$dell .= "$tiles[0]|$tiles[1]";
}
}

if (!$datei) $datei = dirname(__FILE__)."/$filename";
$time = @time();
$ip = $REMOTE_ADDR;
$string = "$dell";
$a = fopen("$filename", "w+");
fputs($a, $string);
fclose($a);
?>
-----------------------------------------------------------------------

CONFIG.PHP3
---------------------------------------------------------------------
<?php

// Timeout - After this time the users will*
// be deleted (in minutes)
$timer = 100;

// Name of the file where all the data, about
// the user's activity will be saved
$filename = "$DOCUMENT_ROOT/useronline/log.txt";

?>
--------------------------------------------------------------------------

LOG.TXT

esta vacio
-----------------------------------------------------------------------
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:15.