<?php
Error_Reporting(E_ALL & ~E_NOTICE);
@fopen("../data/data_forum/online.dat","a+"); @fclose("data/online.dat");
@fopen("../data/data_forum/day.dat","a+"); @fclose("data/day.dat");
$ip_t=$REMOTE_ADDR;
$time_t= date('H').date('i');
$day_t= date('j');
$brauz_t = $HTTP_USER_AGENT;
$a= fopen("../data/data_forum/day.dat","r");
$day_l= fgets($a,10);
fclose($a);
$vsego =file("../data/data_forum/online.dat");
$online =0;
if ($day_t == $day_l )
{
$i =0;
while ( isset( $vsego[$i]))
{ $w =strlen( $vsego[$i]);
$vsego[$i] = substr( $vsego[$i] , 0 , $w -1);
$i++; }
$i =0;
$time_l= $time_t -5 ;
unlink("../data/data_forum/online.dat");
$fp =@fopen("../data/data_forum/online.dat","a+");
flock($fp,LOCK_EX);
while ( isset( $vsego[$i]))
{ if ( $vsego[$i] != $login )
{ if ( $vsego[$i +1] > $time_l )
{ fputs($fp , $vsego[$i] ."\n");
fputs($fp , $vsego[$i +1] ."\n");
fputs($fp , $vsego[$i +2] ."\n");
fputs($fp , $vsego[$i +3] ."\n");
$online++;
}
else { }
}
$i = $i +4;
}
flock ($fp,LOCK_UN);
fclose($fp);
@chmod("$fp", 0777);
}
else { unlink("../data/data_forum/day.dat");
$fp =@fopen("../data/data_forum/day.dat","a+");
flock($fp,LOCK_EX);
fputs($fp , $day_t );
flock ($fp,LOCK_UN);
fclose($fp);
@chmod("$fp", 0777);
unlink("../data/data_forum/online.dat");
@fopen("../data/data_forum/online.dat","a+");
@fclose("../data/data_forum/online.dat");
}
if ( $login !="" &&
$login !=" " &&
isset($login) &&
$pass !="" &&
$pass !=" " &&
isset($pass))
{
$fp =fopen("../data/data_forum/online.dat","a+");
flock($fp,LOCK_EX);
fputs($fp , $login ."\n");
fputs($fp , $time_t ."\n");
fputs($fp , $ip_t ."\n");
fputs($fp , $brauz_t ."\n");
flock ($fp,LOCK_UN);
fclose($fp);
@chmod("$fp", 0777);
$online++;
}
unlink("../data/data_forum/day.dat");
$fp =@fopen("../data/data_forum/day.dat","a+");
flock($fp,LOCK_EX);
fputs($fp , $day_t );
flock ($fp,LOCK_UN);
fclose($fp);
?>