<? 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
-->