With this class you can easily store, display and send files from a db.
It has a built-in hit counter and stores information of last edition, upload, etc..
This class uses my db abstraction layer, AbstractDB
(http://www.phpclasses.org/browse.html/package/846.html) , which allows a unified and easy access to databases, which you can see in this class.
CONSTRUCTOR:
function FileDB(&$db, $host, $database, $user, $password)
FUNCTIONS:
function add($file_name, $file_descr = '')
function remove($id)
function get($id, $addHit = true)
function getWhere($from, $where = '', $addHit = true)
function getFile($id, $addHit = true)
function getFileData($id)
function getIds()
function sendFile($id)
This class can be used to display a graphical page hit counter.
It read, update and stores the page hit counts in text files.
The counter is displayed a sequence of HTML tags for images that represent each digit of the current page hit count.
The counter digits may display trailing zeros. The width and height of the digit images can also be configured.
The class comes with a set of digit image files but it can also be configured to use a set of the digit files from custom image directory.
New features are "Triger Page" the counter will only increment on a single page, but can be viewed on all pages.
3-D style border for use with borderless digits, gives the impression the whole counter is a single image.
Keep track of user accesses to site pages in MySQL
This is a simple class that keeps track of the accesses of users to the pages of a site using a MySQL table to record the user access hits.
The class connects to the MySQL database and records in the counter table the IP address of the user accessing the site and the current time. The class assumes that each IP address corresponds to one user.
The class is also able to query the counter table and retrieve:
1) The total number hits
2) The total number of visits
3) The number of users, which are online. A user is considered to be online if he has accessed to the site within a period of time defined by the class variable online time.
4) The number of hits of one user during the last 24 hours
Apart from counting hits to an arbitrary number of pages this class has the following features: Each IP address is counted only once a day (however, no cookies are neccessary), the data is stored in a single text file (no database neccessary) and monthly snapshots of the counter are saved as well. Comments and examples included in source file.