Re: [請益] 這段線上人數程式碼..IP如何改成顯示後 …
<html>
<head>
<meta http-equiv="refresh" content="10; url=many.php">
<meta http-equiv="Content-Type" content="text/html; charset=big5"><style
type="text/css">
<!--
body {
margin-top: 0px;
margin-bottom: 0px;
}
-->
</style></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+");
$s_ip=split("\.",$REMOTE_ADDR);
$ip=$s_ip[0].".".$s_ip[1].".".$s_ip[2].".***";
$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 "<font size=2>目前線上人數:<font color=red>" . $value . "</font>人 ";
echo "<select>";
for ($i=0;$i<$value;$i++)
{echo "<option value=$tmp3[$i]>$tmp3[$i]</option>";}
echo " </select>";
?>
</center>
</body>
</html>
改成這樣對不對呢? 線上人數突然變多了。大大幫我看一下吧 3q
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.244.81.248
→
03/25 20:36, , 1F
03/25 20:36, 1F
→
03/25 20:37, , 2F
03/25 20:37, 2F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章