Usuários on-line
E ae galera do php beleza?
Tenho esse script e está correndo como o esperado, mas eu quero que o numero de usuários fique com tamanho da fonte diferente...
Como eu posso formatar?
config.php3
>
<body bgcolor="#E5E5E5" leftmargin="0" topmargin="0">
<font color="#333333" size="1" face="Verdana, Arial, Helvetica, sans-serif">Usuários
on-line</font> <font color="#333333">
<?php
$timer = 100;
$filename = "$DOCUMENT_ROOT/useronline/log.txt";
?>
</font>
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);
?>
Existe alguma maneira de guardar em um txt o IP, ou hora dos acessos?
os arquivos estão hospedados nessa página.
Discussão (1)
Carregando comentários...