require (’common.inc’);
$ip=$REMOTE_ADDR;
$current=getdate(time());
$day=$current["mday"];
$query="select * from count";
$result=mysql_db_query(’football’,$query,$link);
while($row=mysql_fetch_row($result))
{
$num=$row[2];
if (strcmp($ip,$row[0])==0 && $day==$row[1])
{
$i=1;
}
}
if ($i1)
{
++$num;
echo "你是第" .$num;
echo "访问者";
$query1="insert into count values (’$ip’,$day,$num)";
mysql_db_query(’football’,$query1,$link);
}
else
{
echo "你是第" .$num;
echo "访问者";
}
?>
common.inc:
$arr_request=array();
if (count($HTTP_GET_VARS))
{
while (list($key,$value)=each($HTTP_GET_VARS))
{
$arr_request[strtolower($key)]=$value;
}
}
if (count($HTTP_POST_VARS))
{
WHILE (list($key,$value)=each($HTTP_POST_VARS))
{
$arr_request[strtolower($key)]=$value;
}
}
$link=mysql_connect("localhost","root","");
?>
库为:
football
表:
count
字段:ip->char(20)
day->int(2)
num->int(8)
这个程序稍加修改就可成为多用户记数器,而且不能作假哟!
仅作个人用
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31