当前位置:Linux教程 - Php - 线人谁显示php代码

线人谁显示php代码

            线人谁显示php代码

            http://www.wlc.uni.cc/web/online.php?
            演示
            <?php
            
/*mintime刷新时间       name用户如guest $_SESSION["name"]*/               
            
$mintime=300;               
            
$time=time();
            
$a=@file("./data.txt");
            
$count=$n=count($a);
            for(
$i=0;$i<=$n-1;$i++)
            {
            list(
$ip,$lastname,$lasttime)=@explode("│!!!│",$a[$i]);
            if(
$ip==$REMOTE_ADDR││$time-$lasttime>$mintime││$time-$lasttime<-$mintime){$a[$i]="";$count--;continue;}

            echo
$lastname;
            }
            
$count++;
            echo
$name."当前在线 $count 人";
            if(
$fp=@fopen("./data.txt","w"))
            {@
flock($f,LOCK_EX);
            @
fwrite($fp,join("",$a)."$REMOTE_ADDR│!!!│$name│!!!│$time│!!!│\n");
            @
fclose($fp);
            }
            
?>