将访问者统计信息限制为30天

时间:2014-04-14 08:29:11

标签: php mysql statistics visitors

我正在尝试编辑Ghaffar Khan的伟大访客统计脚本(PHP / MySQL)(http://www.codeproject.com/Articles/35570/Site-Statistics-with-PHP-and-MySQL的完整脚本),但我很难将图中显示的访问者限制为仅来自过去30天。很遗憾没有关于如何做到这一点的指示,到目前为止我一直在努力。这是主要的脚本:

<?php

include("configuration.php");

$page = input($_GET['page']) or die('ERROR: Missing page ID');    

mysql_select_db($database, $con);

// Get Total Visits Count
$query='SELECT COUNT( * ) total FROM  '.$tableName.' where section=\''.$page.'\'';
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_NUM);
$count = $row[0]; 

// Get Unique Visitors Count
$query='SELECT  count(distinct IP) FROM '.$tableName.' where section=\''.$page.'\'';
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_NUM);
$UniaquCount = $row[0];
mysql_close($con);

/* Graph Rendering Script goes here */

?>

我最好的猜测是,如果日期(包含在SQL字段“Date”中)来自过去30天内,则只添加一行来计算访问次数。我自己并不是一个非常有才华的PHP开发人员(更多的是图形/设计人员),我真诚地感谢你们提供的任何帮助。

0 个答案:

没有答案