Location: PHPKode > projects > The Duliga / Die Duliga > chat/incl/users.inc
<?php function sdd(){die('you should set a correct path ($pth=\'\') to the chat directory...');}if(!isset($pth)){sdd();}$usr="$pth/data/usr";$pp=time();
function opu(){global $usr;$fd=fopen($usr,"r") or die(sdd());$fs=fread($fd,filesize($usr));fclose($fd);return $fs;}function wru($n){global $usr;$fd=fopen($usr,"w") or die(sdd());$fout=fwrite($fd,$n);fclose($fd);}
function whos_online($r){$j=0;global $pth;$users='';$fy=opu();$fy=explode("\n",$fy);$fz=array();for($i=0;$i<count($fy);$i++){if(isset($fy[$i])&&strlen($fy[$i])>4){$we=explode(":|:",$fy[$i]);$fz[$j]="$we[2]:|:$we[3]:|:$we[1]";$j++;}}rsort($fz);for($i=0;$i<count($fz);$i++){$wg=explode(":|:",$fz[$i]);$users="<img src=\"$pth/pics/$wg[1].gif\" width=\"11\" height=\"14\" alt=\"\"> $wg[0] $r $users";}print $users;}
$j=0;$fx=array();$fy=opu();$fy=explode("\n",$fy);for($i=0;$i<count($fy);$i++){if(isset($fy[$i])&&$fy[$i]!=''){$rt=explode(":|:",$fy[$i]);if($pp-$rt[0]<70){$fx[$j]=$fy[$i];$j++;}}}$fx=implode("\n",$fx);wru($fx); ?>
Return current item: The Duliga / Die Duliga