Просмотр файла UserOnline/useronline.php

Размер файла: 1.45Kb
<?
$daten="besucher.txt";
$time = time();

$brow=("$REMOTE_ADDR");
$user = explode ('/', $HTTP_USER_AGENT); 
$ip = ("Phone: $user[0] IP: $brow");

$ablaufzeit = "$time"-"300"; //zdes mozhno nastroit wremja kak dolgo ip budet xranitsja w txt fajle
$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"; /*eto pokazivaet koli4estwo 4elowek na sajte,
nado sozdat eshe textfile besucher.txt  i ego chmod777,
u menja etot script wstawlen tolko w index.php kone4no mozhesh wstawit ego w kazhduju stranicu*/

?>