Summary and Features:
This is a Free PHP script to record and view daily website page views (hits) for statistical tracking. Features a chart of daily page views totals displayed with bar graph, total for last x days, most hits in a day for last x days, average hits per day for last x days, projected hits for today, and more. Easy to install.
Note: As you can see in the saved screen image, the script settings were set to show only the last 4 days (for sake of image size). The red bar shows the projected hits for today.
Download current version:
Current version: v1.1.0
Last modified: July 31, 2003
Created: June 24, 2003
Download source code, scripts, and documentation:
PHP and MySQL database.
Edit the default values in config.php for MySQL; changing other variables is optional. Do not edit other files.
Copy the files to the same directory on your server.
Install MySQL table. Execute the following in PhpMyAdmin or other MySQL interface:
CREATE TABLE stats_day (
date date DEFAULT '0000-00-00' NOT NULL,
hits mediumint(8) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (date)
For php files, you can add this code to each page to record page views to it (be sure to add the path if needed):
<?php include "fstats.php" ?>
If the page is in a different folder than the stats script, you can add the path such as:
<?php include "../stats/fstats.php" ?>
You can record stats for non-php pages (and php pages also) by adding this code in the body of the html (remember to add the correct path to the script; you can use a full url here; Note, this only records hits for browsers with images-loading enabled):
<img width=1 height=1 border=0 alt="" src="../stats/fstats.php">
FREE (GPL - See Copyright and
Copyright and Terms:
This software is copyright (C) 2003 Free-Webhosts.com. It is distributed
under the terms of the GNU General Public License (GPL). Because it is licensed
free of charge, there is NO WARRANTY, it is provided AS IS. The author can not
be held liable for any damage that might arise from the use of this software.
Use it at your own risk.
All copyright notices and links to Free-Webhosts.com website MUST remain intact in the scripts and in the HTML for the scripts.
For more details, see GPL license (or http://www.gnu.org/).
Version 1.1.0 - July 31, 2003
Added a form to show stats for last x number of days.
Prints stats for the day with least hits.
Prints server time, and length of time that hits have been recorded.
Numbers are formatted with commas. Many other format changes.
Projected hits extra shown on graph with additional bar image.
Now includes days with 0 hits in stats.
"Average hits per day for last x days" is figured using projected hits for today.
Version 1.0.0 -- June 24, 2003
Please feel free to contact us with any comments, suggestions, bug fixes,
or constructive criticism.