Файл: include/who.php
Строк: 19
<?php
if (isset($user)) {
$who_lastusers="30"; // не советую много писать
$ip=$_SERVER['REMOTE_ADDR'];
$u1=getenv('HTTP_USER_AGENT');
$brow=strtok($u1,'/');
$ip=htmlspecialchars(stripslashes($ip));
$brow=htmlspecialchars(stripslashes($brow));
$lines=file("MySql/base123/who.dat");
$count=count($lines);
for ($b=0; $b<$count; $b++) { list($sinbase)=explode("|",$lines[$b]); if ( $user == "$sinbase") { $del=$b;
$fp=fopen("MySql/base123/who.dat","w");
flock ($fp,LOCK_EX);
unset($lines[$del]);
fputs($fp, implode("",$lines));
flock ($fp,LOCK_UN);
fclose($fp);} }
$time=time();
$self = $_SERVER['SCRIPT_NAME'];
$ttt="$user|$self|$time";
$fp = @fopen("MySql/base123/who.dat","a+");
flock ($fp,LOCK_EX);
@fputs($fp,"$tttrn");
fflush ($fp);
flock ($fp,LOCK_UN);
@fclose($fp);
$file=file("MySql/base123/who.dat"); $i = count($file);
if ($i>=$who_lastusers) {
$fp=fopen("MySql/base123/who.dat","w");
flock ($fp,LOCK_EX);
unset($file[0]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);}}else{exit ;}
?>