a me no guarda:Qui
tfai aggiorna i numeri salgono ora ti ripeto tutto quello usato e dimmi dove erro:
online.php
Codice PHP:
<?
$max = 10;//minuti di tempo online
$filename = "online.txt";
function user()
{
global $max, $filename;
$max *= 60;
if( file_exists($filename) == false )
{
$fo = fopen($filename, 'w');
fclose($fo);
}
$file = file($filename);
$file = array_reverse($file);
for($i = 0; $i < count($file); $i++)
{
list($usr, $time, $date) = explode('|', $file[$i]);
if( $time >= ( time() - $max ) )
{
add(ip(), $date);
}
}
$fp = fopen($filename, 'a+');
if( $fp == false )
{
die('File non trovato');
}
fwrite($fp, ip() . '|' . time() . '|' . date('d-m-y H:i') . "\n" );
fclose($fp);
}
function ip()
{
$ip = $_SERVER['REMOTE_ADDR'];
list($a, $b, $c, $d) = explode('.', $ip);
$return = $a . '.' . $b . '.' . $c . '.';
$len = strlen($d);
for($i = 1; $i <= $len; $i++)
{
$return .= 'x';
}
return $return;
}
function add($ip, $data)
{
global $archive;
$archive[] = array($ip, $data);
}
function show()
{
global $archive;
echo count($archive);
}
?>
funge.php (dove rikiamo online.php)
Codice PHP:
<?
include("online.php");
user();
show();
?>