View file lib/useronline.php

File size: 1.15Kb
<?
$daten="online.txt";
$time = time();

$brow=$_SERVER['REMOTE_ADDR'];
$user = explode ('/', $_SERVER['HTTP_USER_AGENT']); 
$ip = ("Phone: $user[0] IP: $brow");
$ablaufzeit = "$time"-"300";
$pruefung = @file($daten);
while (list ($line_num, $line) = @each ($pruefung))
{$zeiten = explode("&&",$line);
if($zeiten[0] <= $ablaufzeit)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$ippruefung = @file($daten);
while (list ($line_num, $line) = @each ($ippruefung))
{$ips = explode("&&",$line);
if($ips[1] == $ip)
{$fp = fopen( "$daten", "r" );
$contents = fread($fp, filesize($daten));
fclose($fp);
$line=quotemeta($line);
$string2 = "";
$replace = ereg_replace($line, $string2, $contents);
$fh=fopen($daten, "w");
@flock($fp,2);
fputs($fh, $replace);
@flock($fp,3);
fclose($fh);}}
$fp = fopen("$daten", "a+");
flock($fp,2);
fputs ($fp, "$time&&$ip&&\n");
flock($fp,3);
fclose ($fp);
$anzahldaten = file($daten);
$anzahl = count($anzahldaten);

echo"$anzahl";
?>