<? PHP
Ob_start ();
Session_start ();
$ Num = 0;
$ Dirpt = "online ";
$ Reftime = 1;
If (is_dir ($ dirpt) & $ dir = opendir ($ dirpt )){
While ($ file = readdir ($ DIR ))! = False ){
If (strcmp ($ file, "..") = 0 | strcmp ($ file, ".") = 0 ){
Continue;
}
$ D _ [date ("Y-m-d h: I: s", filemtime ($ dirpt. "/". $ file)] = $ file;
$ Num ++;
Unset ($ cum );
}
Closedir ($ DIR );
$ Filename = session_id ();
$ Fp = fopen ($ dirpt. "/". $ filename, "W ");
Fputs ($ FP ,"");
Fclose ($ FP );
$ Ntime = date ("Y-m-d h: I: s", mktime (date ("H"), date ("I")-1, 0, date ("M"), date ("D"), date ("Y ")));
$ D _ [$ ntime] = "-";
Krsort ($ D _);
$ Onlinenumber = 0;
While (1 ){
$ Vkey = Key ($ D _);
$ Onlinenumber ++;
If (strcmp ($ ntime, $ vkey) = 0 ){
Break;
} Else {
Array_shift ($ D _);
}
}
Array_shift ($ D _);
Reset ($ D _);
While (count ($ D _)> 0 ){
$ Ckey = Key ($ D _);
Unlink ($ dirpt. "/". $ D _ [$ ckey]);
If (! Next ($ D _)){
Break;
}
}
} Else {
@ Chmod ("...", 0777 );
@ Mkdir ($ dirpt, 0777 );
}
$ Online = $ onlinenumber-1;
$ Retime = 60 * $ reftime;
Echo "Current online <strong> <font color = Red> $ online </font> </strong> <meta http-equiv = Refresh content = \" {$ retime }, url = \ "> ";
Ob_end_flush ();
?>
<! --
Statistics on the number of online users using file attributes combined with Session
Author: sports98
Written on: 2003-3-19
-->