php数据统计功能 php统计函数( 二 )


$RecordDate_explode[1]
)
$IsGone
=
TRUE;
else
if(
$DateNow_explode[1]
==
$RecordDate_explode[1]
){
if(
$DateNow_explode[2]
$RecordDate_explode[2]
)
$IsGone
=
TRUE;
}else
BREAK;
}else
BREAK;
//根据IsGone进行相应操作
IF($IsGone)
{
$RecordDate
=
$DateNow;
$CounterToday
=
0;
$CounterLastDay
=
$row['CounterToday'];
$upd_sql
=
"update
mycounter
set
RecordDate
=
'$RecordDate',CounterToday
=
'$CounterToday',CounterLastDay
=
'$CounterLastDay'
WHERE
id
=
?'
";
mysql_query($upd_sql);
}
//再次获取数据
$querysql
=
"SELECT
*
FROM
`mycounter`
WHERE
id
=
?'
";
$queryset
=
mysql_query($querysql);
$Counter
=
$row['Counter'];
$CounterToday
=
$row['CounterToday'];
$CounterLastDay
=
$row['CounterLastDay'];
if($row
=
mysql_fetch_array($queryset)
){
if(
$_COOKIE["user"]
!=
"oldGuest"
){
$Counter
=
++$row['Counter'];
$CounterToday
=
++$row['CounterToday'];
$upd_sql
=
"update
mycounter
set
counter
=
'$Counter',CounterToday
=
'$CounterToday'
WHERE
id
=
?'
";
$myquery
=
mysql_query($upd_sql);
}
echo
"总访问量:".$Counter;
echo
"
";
echo
"今日流量:".$CounterToday;
echo
"
";
echo
"昨日流量:".$CounterLastDay;
}else{//如果数据库为空时php数据统计功能,相应的操作
}
}
?
当然,需要在文件第一行开始写出如下代码:
复制代码
代码如下:
?PHP
session_start();
if(
!isset($_COOKIE["user"])
){
setcookie("user","newGuest",time()+3600);
}else
{
setcookie("user","oldGuest");
}
?
【php数据统计功能 php统计函数】php数据统计功能的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于php统计函数、php数据统计功能的信息别忘了在本站进行查找喔 。

推荐阅读