// PHP-Fusion Content Management System // Copyright © 2002 - 2008 Nick Jones // http://www.php-fusion.co.uk/ // ------------------------------------ // Infusion: Site Hit Stats // Author: John Kirchner // Web: www.programmingsource.net // ------------------------------------ //require_once "../../maincore.php"; if (!defined("DB_STATS_TOTAL")) { define("DB_STATS_TOTAL", DB_PREFIX."stats_total"); } if (!defined("DB_STATS_DAY")) { define("DB_STATS_DAY", DB_PREFIX."stats_day"); } //TOTAL HITS $result = dbquery("UPDATE ".DB_STATS_TOTAL." SET count=count+1"); //DAILY HITS $result1 = dbquery("SELECT * from ".DB_STATS_DAY." ORDER BY id DESC"); while($result1 = dbarray($result1)) { $hitid = $result1['id']; } $result2 = dbquery("SELECT * from ".DB_STATS_DAY." WHERE id=$hitid"); while($result2 = dbarray($result2)) { $statdate = $result2['hitdate']; $checkdate = date('m-d-y', $statdate); $currentdate = date('m-d-y'); } if ($checkdate == $currentdate) { $result3 = dbquery("UPDATE ".DB_STATS_DAY." SET hits=hits+1 WHERE hitdate='$statdate'"); } else { $addid = $hitid+1; $addtime = time(); $result3 = dbquery("INSERT INTO ".DB_STATS_DAY." (id, hitdate, hits) VALUES ('$addid', '$addtime', '0')"); } ?>
![]() |
|
|
|
| 22 May, 2013 | 1,212,149 unique visits |
Powered by PHP-Fusion copyright © 2002 - 2013 by Nick Jones. Released as free software without warranties under GNU Affero GPL v3. |