JPCounterClass Install File
--- TABLE OF CONTENTS -----------------------
1. Quick Installation
2. Database Installation
3. Usage / Examples
--- 1. QUICK INSTALLATION -------------------
To install, unzip the contents into a folder
or into root dir, and go into the class.php
file and change the database information.
--- 2. DATABASE INSTALLATION-----------------
open up your MySQL Query Enterer, and enter
the following query into it, or save the
following in a file (name.sql) and import it
into the table. or use the included file
___QUERY______________________________
CREATE TABLE counter (
id int(2) NOT NULL auto_increment,
filename varchar(255) NOT NULL default '',
visitor varchar(255) NOT NULL default '',
time varchar(255) NOT NULL default '',
PRIMARY KEY ( id )
) ENGINE=MyISAM;
______________________________________
--- 3. USAGE / EXAMPLES ---------------------
A. To use the counter on a page, just include
the class file, and everything is initiated
within the file
include "path/to/counter.class.php";
B. All pages should containn the following line
in them, but if you wish to show the counter
WITHOUT counting a hit, just make the second
paramater FALSE.
NOTE: the first paramater MUST be $_SERVER, or
the application will not record the page, both
total and unique, unique person will be OK
$cnt->Hit($_SERVER, [Opt] false);
C. To access the differnt stats, the above line
should be called already, or your results will
be empty. Only the Days option has a paramater
which is how many days to look at
--Total site hits, and unique user hits
$cnt->Total();
$cnt->UniqueTotal();
--Total page hits, and unique user hits (every page has its own counter)
$cnt->Page();
$cnt->UniquePage();
--Total hits for today (since 12:00:01 AM), and unique visitor hits
$cnt->Today();
$cnt->UniqueToday();
--Total hits in the past # of days (specified by $days), and unique hits
$cnt->Days( $days );
$cnt->UniqueDays( $days );
--Total hits for today (since 12:00:01 AM), and unique visitor hits
For the specific page
$cnt->TodayPage();
$cnt->UniqueTodayPage();
--Total hits in the past # of days (specified by $days), and unique hits,
For the specfic page
$cnt->DaysPage( $days );
$cnt->UniqueDaysPage( $days );
D. To include a cool counter on your page, just call the below function
the image is colored optional, text always navy blue, and is 132 x 43 pixels.
$cnt->AddImage( $color ); |