您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用IP地址来统计访问人数!以天为间限!_PHP

2025/7/17 22:41:03发布19次查看
ip地址
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)
这个程序稍加修改就可成为多用户记数器,而且不能作假哟!
仅作个人用!
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product