visitorTracking icon indicating copy to clipboard operation
visitorTracking copied to clipboard

A simple PHP class to gather visitor information, and store it in a database using MYSQLi

visitorTracking GitHub License GitHub Release

visitorTracking is a simple PHP class to gather visitor information, and store it in a database using MYSQLi. It's more modern and complete than others I have seen around on Google/HotScripts. (SQLi, oop(ish?), etc...) No bells or whistles, fully customizable.

Download

Old Versions

Documentation

http://tyrexi.us/visitorTrackingDocumentation

Demo

http://tyrexi.us/visitorTracking

Install

  1. Upload the files to your server.

  2. Edit the database configuration ( src/_installation/db.php )

  3. Create the visitors table in your database. (src/_installation/visitors.sql )

  4. Instance the class in your code.

Usage

//define database
define( 'DB_HOST', 'localhost' );           // set database host
define( 'DB_USER', 'root' );                // set database user
define( 'DB_PASS', '' );                    // set database password
define( 'DB_NAME', 'yourdatabasename' );    // set database name

//include the class
include( 'src/class.visitorTracking.php' );

//instance the class
$visitors = new visitorTracking();

The constructor method automatically calls the tracking method $visitors->track(); which inserts the collected data.

You print the array containing the current visit by echoing $visitors->displayThisVisit();

You can output a table containing all the paginated data from the database by echoing $visitors->displayVisitors();

Alternatively, you can just grab the table data from your database SELECT * FROM visitors ORDER BY date DESC and format it according to your specifications.

License

This project is licensed under the MIT LICENSE

Contributors

Contributors on GitHub

Contributing

If you would like to help make this software better, please follow our guidelines found in CONTRIBUTING.md

Contact

  • Homepage: http://heshka.com
  • E-mail: [email protected]
  • KeyBase: https://keybase.io/theshka