求统计在线人数的程序! up需要的话,我可以给你一个学习例子。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html> <head> <meta http-equiv="refresh" content="10; url=many.php"> </head> <body> <center> <? $time=gettimeofday(void); $tmp=file("time.txt"); if ($tmp[0]=="") { $fopen0=fopen("time.txt","w+"); fputs($fopen0,$time[sec]); fclose($fopen0); $fopen1=fopen("ip.txt","w+"); fputs($fopen1,""); fclose($fopen1); } $tmp1=file("time.txt"); $equal=($time[sec]-$tmp1[0]); if ($equal>60) { $fopen0=fopen("time.txt","w+"); fputs($fopen0,""); fclose($fopen0); } $fopen=fopen("ip.txt","a+"); $ip=$REMOTE_ADDR; $flag=1; $tmp2=file("ip.txt"); $con=count($tmp2); for ($i=0;$i<$con;$i++) { if ($ip."\n"==$tmp2[$i]) { $flag=0; break; } } if ($flag==1) { $ipstring=$ip."\n"; fputs($fopen,$ipstring); } fclose($fopen); $tmp3=file("ip.txt"); $value=count($tmp3); echo "目前在线人数:".$value; ?> </center> </body> </html> IE下cookie设置无效 二个数组合成一个数组,在线等 php会员注册问题 session一分钟就过期了 郁闷问题,可怜俺不知道!!!! PHP搜索关键字问题!谢谢回答. Maximum execution 错误信息能不能改成别的? 如何用php生成excel ?在线等! 请教,如何把下面数组用递归算法,显示一棵树? 关于php的CGI方式在NT IIS的安装配置问题? php的fread为什么读不出内容? 求PHP与mysql教程
<head>
<meta http-equiv="refresh" content="10; url=many.php">
</head>
<body>
<center>
<?
$time=gettimeofday(void);
$tmp=file("time.txt");
if ($tmp[0]=="")
{ $fopen0=fopen("time.txt","w+");
fputs($fopen0,$time[sec]);
fclose($fopen0); $fopen1=fopen("ip.txt","w+");
fputs($fopen1,"");
fclose($fopen1);
}
$tmp1=file("time.txt");
$equal=($time[sec]-$tmp1[0]);
if ($equal>60)
{ $fopen0=fopen("time.txt","w+");
fputs($fopen0,"");
fclose($fopen0);
} $fopen=fopen("ip.txt","a+");
$ip=$REMOTE_ADDR; $flag=1;
$tmp2=file("ip.txt");
$con=count($tmp2); for ($i=0;$i<$con;$i++)
{
if ($ip."\n"==$tmp2[$i])
{
$flag=0;
break;
}
} if ($flag==1)
{
$ipstring=$ip."\n";
fputs($fopen,$ipstring);
}
fclose($fopen); $tmp3=file("ip.txt");
$value=count($tmp3);
echo "目前在线人数:".$value;
?>
</center>
</body>
</html>