今,昨,周,月 页面访问统计
2008-12-07 02:18
162 查看
<script type="text/javascript"><!--
google_ad_client = "pub-4490194096475053";
/* 内容页,300x250,第一屏 */
google_ad_slot = "3685991503";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>//自己做一个网站是用到的,在每个php文件中调用page_count()这个函数即可!
放在数据库配置文件中是个好注意!
// 页面访问统计表
CREATE TABLE statistics
(
today int not null,
yesterday int not null,
this_week int not null,
this_month int not null,
overall int not null,
date int not null
)ENGINE=MyISAM DEFAULT CHARSET=utf8;
// 页面访问统计
function page_count() {
global $mysql;
if (isset($_SESSION['js']))
return false;
$sql = "SELECT * FROM statistics";
$mysql->MysqlQuery($sql);
$re_arr = $mysql->MysqlResultArray();
$today = $re_arr[0]['today']; // 今天
$yesterday = $re_arr[0]['yesterday']; // 昨天
$this_week = $re_arr[0]['this_week']; // 本周
$this_month = $re_arr[0]['this_month']; //本月
$overall = $re_arr[0]['overall']; // 所有
$date = $re_arr[0]['date'];
if (date('d') == date('d', $date)) { // 现在时间的天数与上次访问时候天数
$today += 1;
}else {
$yesterday = $today;
$today = 1;
}
if (date('W') == date('W', $date)) {
$this_week += 1;
}else {
$this_week = 1;
}
if (date('m') == date('m', $date)) {
$this_month += 1;
}else {
$this_month = 1;
}
$overall+=1;
$time = time();
$sql = "UPDATE statistics SET today=$today, yesterday=$yesterday, this_week=$this_week, this_month=$this_month, overall=$overall, date=$time";
$mysql->MysqlQuery($sql);
$_SESSION['js'] = true;
}
google_ad_client = "pub-4490194096475053";
/* 内容页,300x250,第一屏 */
google_ad_slot = "3685991503";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>//自己做一个网站是用到的,在每个php文件中调用page_count()这个函数即可!
放在数据库配置文件中是个好注意!
// 页面访问统计表
CREATE TABLE statistics
(
today int not null,
yesterday int not null,
this_week int not null,
this_month int not null,
overall int not null,
date int not null
)ENGINE=MyISAM DEFAULT CHARSET=utf8;
// 页面访问统计
function page_count() {
global $mysql;
if (isset($_SESSION['js']))
return false;
$sql = "SELECT * FROM statistics";
$mysql->MysqlQuery($sql);
$re_arr = $mysql->MysqlResultArray();
$today = $re_arr[0]['today']; // 今天
$yesterday = $re_arr[0]['yesterday']; // 昨天
$this_week = $re_arr[0]['this_week']; // 本周
$this_month = $re_arr[0]['this_month']; //本月
$overall = $re_arr[0]['overall']; // 所有
$date = $re_arr[0]['date'];
if (date('d') == date('d', $date)) { // 现在时间的天数与上次访问时候天数
$today += 1;
}else {
$yesterday = $today;
$today = 1;
}
if (date('W') == date('W', $date)) {
$this_week += 1;
}else {
$this_week = 1;
}
if (date('m') == date('m', $date)) {
$this_month += 1;
}else {
$this_month = 1;
}
$overall+=1;
$time = time();
$sql = "UPDATE statistics SET today=$today, yesterday=$yesterday, this_week=$this_week, this_month=$this_month, overall=$overall, date=$time";
$mysql->MysqlQuery($sql);
$_SESSION['js'] = true;
}
相关文章推荐
- 使用免费开源软件slimstat统计php页面访问状况
- PHP统计nginx访问日志中的搜索引擎抓取404链接页面路径
- JSP+Servlet+JavaBean统计页面在线访问次数
- 页面访问数据统计[初步]
- 页面统计数据库表建立访问
- 实现页面访问次数统计
- MySQL页面访问统计及排名情况
- 简单页面访问统计
- 访问统计(浏览过的页面)
- jq 更新访问次数并统计页面停留时间
- 页面访问统计
- jsp计数器--页面统计特定用户的登录次数或所有人的访问信息
- 统计单个页面的停留时间(页面访问时间)
- html页面静态页面实现统计访问人数实例代码
- session实现购物系统的简例和application实现统计页面访问次数的简例
- 使用MySQL统计页面访问及排名
- 访问统计(浏览过的页面)[数据库设计]
- 页面访问统计 提取url中的关键字
- js统计页面访问次数
- 统计:访问以下页面的访问者的组件,点击计数地图工具