改进的IP计数器
2001-03-30 16:34:20 来源:WEB开发网核心提示:<?//require (’common.inc’);$arr_request=array();if (count($HTTP_GET_VARS)){while (list($key,$value)=each($HTTP_GET_VARS)){$arr_request[strtolower($key)]=$val
<?
//require (’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","kong","kong");
mysql_select_db("mywebdb");
$ip=$REMOTE_ADDR;
$current=getdate(time());
$day=$current["mday"];
$query="select * from addcount where day=\"$day\"";
$result=@mysql_query($query);
if(!$num=@mysql_num_rows($result))
$num=1;
while($row=@mysql_fetch_row($result))
{
if (strcmp($ip,$row[1])==0)
{
$i=1;
$id=$row[0];
$click=$row[3]+1;
$up="update addcount set click_count=click_count+1 where id=$id";
$result2=@mysql_query($up);
// break;
}
$total+=$row[3];
}
$total++;
if(!$i){
$query1="insert into addcount (ip,day,click_count )values ('$ip','$day',1)";
mysql_db_query("mywebdb",$query1,$link);
$click=1;
}
echo "<html><head><title>计数器</title></head>";
echo "你是第" .$num."访问者<BR>";
echo "今天你第".$click."次点击<BR>";
echo "今天总点击".$total."次<BR>";
/*
表:
addcount
CREATE TABLE addcount (
id int(6) DEFAULT '0' NOT NULL auto_increment,
ip char(20) NOT NULL,
day int(2) NOT NULL,
click_count int(3) NOT NULL,
PRIMARY KEY (id)
);
*/
?>
//require (’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","kong","kong");
mysql_select_db("mywebdb");
$ip=$REMOTE_ADDR;
$current=getdate(time());
$day=$current["mday"];
$query="select * from addcount where day=\"$day\"";
$result=@mysql_query($query);
if(!$num=@mysql_num_rows($result))
$num=1;
while($row=@mysql_fetch_row($result))
{
if (strcmp($ip,$row[1])==0)
{
$i=1;
$id=$row[0];
$click=$row[3]+1;
$up="update addcount set click_count=click_count+1 where id=$id";
$result2=@mysql_query($up);
// break;
}
$total+=$row[3];
}
$total++;
if(!$i){
$query1="insert into addcount (ip,day,click_count )values ('$ip','$day',1)";
mysql_db_query("mywebdb",$query1,$link);
$click=1;
}
echo "<html><head><title>计数器</title></head>";
echo "你是第" .$num."访问者<BR>";
echo "今天你第".$click."次点击<BR>";
echo "今天总点击".$total."次<BR>";
/*
表:
addcount
CREATE TABLE addcount (
id int(6) DEFAULT '0' NOT NULL auto_increment,
ip char(20) NOT NULL,
day int(2) NOT NULL,
click_count int(3) NOT NULL,
PRIMARY KEY (id)
);
*/
?>
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
- ››iPhone 获取指定格式的时间和日期
- ››IPad使用UIModalPresentationFormSheet时隐藏键盘...
- ››IPmt函数用法
更多精彩
赞助商链接