PHP Classes

PHP Visitor Tracking: Track visitor location and details using MySQLi

Recommend this page to a friend!
  Info   View files Example   Demos   Screenshots Screenshots   View files View files (158)   DownloadInstall with Composer Download .zip   Reputation   Support forum (7)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 54%Total: 1,151 This week: 1All time: 3,274 This week: 149Up
Version License PHP version Categories
php-visitor-tracking 1.21Freeware5.0HTML, PHP 5, Databases, Geography
Description Author

This class can track visitor location and details using MySQLi.

It records the details of a site visitor inserting a record in a MySQL database using MySQLi.

The class looks up the user IP address using the NetIP.de Web service to retrieve the user country, domain, state and town name.

It also records in the database the current page the user is visiting, the referrer page and the current date.

The class can also display on a Web page a paginated listing of the latest visitors details.

Recommendations

how to retrieve user ip address from the database
retrieve user ip address from the database

Picture of Tyler Heshka
  Performance   Level  
Name: Tyler Heshka <contact>
Classes: 2 packages by
Country: Canada Canada
Age: ???
All time rank: 171238 in Canada Canada
Week rank: 173 Up3 in Canada Canada Up
Innovation award
Innovation award
Nominee: 1x

Details

visitorTracking

GitHub License Software Version Github Downloads

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: tyler@heshka.com
  • KeyBase: https://keybase.io/theshka
  Visitor Tracking DemoExternal page  

Open in a separate window

Screenshots  
  • Screenshot1
  Files folder image Files  
File Role Description
Files folder imageexamples (1 file)
Files folder imageincludes (1 directory)
Accessible without login Plain text file index.php Example Displays the class
Accessible without login Plain text file LICENSE Data Auxiliary data
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file example1.php Example Example script

  Files folder image Files  /  includes  
File Role Description
Files folder imagefamfamfam-countryflags (154 files)

  Files folder image Files  /  includes  /  famfamfam-countryflags  
File Role Description
  Accessible without login Image file hk.gif Icon Icon image
  Accessible without login Image file hm.gif Icon Icon image
  Accessible without login Image file hn.gif Icon Icon image
  Accessible without login Image file hr.gif Icon Icon image
  Accessible without login Image file ht.gif Icon Icon image
  Accessible without login Image file hu.gif Icon Icon image
  Accessible without login Image file id.gif Icon Icon image
  Accessible without login Image file ie.gif Icon Icon image
  Accessible without login Image file il.gif Icon Icon image
  Accessible without login Image file in.gif Icon Icon image
  Accessible without login Image file io.gif Icon Icon image
  Accessible without login Image file iq.gif Icon Icon image
  Accessible without login Image file ir.gif Icon Icon image
  Accessible without login Image file is.gif Icon Icon image
  Accessible without login Image file it.gif Icon Icon image
  Accessible without login Image file jm.gif Icon Icon image
  Accessible without login Image file jo.gif Icon Icon image
  Accessible without login Image file jp.gif Icon Icon image
  Accessible without login Image file ke.gif Icon Icon image
  Accessible without login Image file kg.gif Icon Icon image
  Accessible without login Image file kh.gif Icon Icon image
  Accessible without login Image file ki.gif Icon Icon image
  Accessible without login Image file km.gif Icon Icon image
  Accessible without login Image file kn.gif Icon Icon image
  Accessible without login Image file kp.gif Icon Icon image
  Accessible without login Image file kr.gif Icon Icon image
  Accessible without login Image file kw.gif Icon Icon image
  Accessible without login Image file ky.gif Icon Icon image
  Accessible without login Image file kz.gif Icon Icon image
  Accessible without login Image file la.gif Icon Icon image
  Accessible without login Image file lb.gif Icon Icon image
  Accessible without login Image file lc.gif Icon Icon image
  Accessible without login Image file li.gif Icon Icon image
  Accessible without login Image file lk.gif Icon Icon image
  Accessible without login Image file lr.gif Icon Icon image
  Accessible without login Image file ls.gif Icon Icon image
  Accessible without login Image file lt.gif Icon Icon image
  Accessible without login Image file lu.gif Icon Icon image
  Accessible without login Image file lv.gif Icon Icon image
  Accessible without login Image file ly.gif Icon Icon image
  Accessible without login Image file ma.gif Icon Icon image
  Accessible without login Image file mc.gif Icon Icon image
  Accessible without login Image file md.gif Icon Icon image
  Accessible without login Image file me.gif Icon Icon image
  Accessible without login Image file mg.gif Icon Icon image
  Accessible without login Image file mh.gif Icon Icon image
  Accessible without login Image file mk.gif Icon Icon image
  Accessible without login Image file ml.gif Icon Icon image
  Accessible without login Image file mm.gif Icon Icon image
  Accessible without login Image file mn.gif Icon Icon image
  Accessible without login Image file mo.gif Icon Icon image
  Accessible without login Image file mp.gif Icon Icon image
  Accessible without login Image file mq.gif Icon Icon image
  Accessible without login Image file mr.gif Icon Icon image
  Accessible without login Image file ms.gif Icon Icon image
  Accessible without login Image file mt.gif Icon Icon image
  Accessible without login Image file mu.gif Icon Icon image
  Accessible without login Image file mv.gif Icon Icon image
  Accessible without login Image file mw.gif Icon Icon image
  Accessible without login Image file mx.gif Icon Icon image
  Accessible without login Image file my.gif Icon Icon image
  Accessible without login Image file mz.gif Icon Icon image
  Accessible without login Image file na.gif Icon Icon image
  Accessible without login Image file nc.gif Icon Icon image
  Accessible without login Image file ne.gif Icon Icon image
  Accessible without login Image file nf.gif Icon Icon image
  Accessible without login Image file ng.gif Icon Icon image
  Accessible without login Image file ni.gif Icon Icon image
  Accessible without login Image file nl.gif Icon Icon image
  Accessible without login Image file no.gif Icon Icon image
  Accessible without login Image file np.gif Icon Icon image
  Accessible without login Image file nr.gif Icon Icon image
  Accessible without login Image file nu.gif Icon Icon image
  Accessible without login Image file nz.gif Icon Icon image
  Accessible without login Image file om.gif Icon Icon image
  Accessible without login Image file pa.gif Icon Icon image
  Accessible without login Image file pe.gif Icon Icon image
  Accessible without login Image file pf.gif Icon Icon image
  Accessible without login Image file pg.gif Icon Icon image
  Accessible without login Image file ph.gif Icon Icon image
  Accessible without login Image file pk.gif Icon Icon image
  Accessible without login Image file pl.gif Icon Icon image
  Accessible without login Image file pm.gif Icon Icon image
  Accessible without login Image file pn.gif Icon Icon image
  Accessible without login Image file pr.gif Icon Icon image
  Accessible without login Image file ps.gif Icon Icon image
  Accessible without login Image file pt.gif Icon Icon image
  Accessible without login Image file pw.gif Icon Icon image
  Accessible without login Image file py.gif Icon Icon image
  Accessible without login Image file qa.gif Icon Icon image
  Accessible without login Image file re.gif Icon Icon image
  Accessible without login Image file ro.gif Icon Icon image
  Accessible without login Image file rs.gif Icon Icon image
  Accessible without login Image file ru.gif Icon Icon image
  Accessible without login Image file rw.gif Icon Icon image
  Accessible without login Image file sa.gif Icon Icon image
  Accessible without login Image file sb.gif Icon Icon image
  Accessible without login Image file sc.gif Icon Icon image
  Accessible without login Image file scotland.gif Icon Icon image
  Accessible without login Image file sd.gif Icon Icon image
  Accessible without login Image file se.gif Icon Icon image
  Accessible without login Image file sg.gif Icon Icon image
  Accessible without login Image file sh.gif Icon Icon image
  Accessible without login Image file si.gif Icon Icon image
  Accessible without login Image file sj.gif Icon Icon image
  Accessible without login Image file sk.gif Icon Icon image
  Accessible without login Image file sl.gif Icon Icon image
  Accessible without login Image file sm.gif Icon Icon image
  Accessible without login Image file sn.gif Icon Icon image
  Accessible without login Image file so.gif Icon Icon image
  Accessible without login Image file sr.gif Icon Icon image
  Accessible without login Image file st.gif Icon Icon image
  Accessible without login Image file sv.gif Icon Icon image
  Accessible without login Image file sy.gif Icon Icon image
  Accessible without login Image file sz.gif Icon Icon image
  Accessible without login Image file tc.gif Icon Icon image
  Accessible without login Image file td.gif Icon Icon image
  Accessible without login Image file tf.gif Icon Icon image
  Accessible without login Image file tg.gif Icon Icon image
  Accessible without login Image file th.gif Icon Icon image
  Accessible without login Image file tj.gif Icon Icon image
  Accessible without login Image file tk.gif Icon Icon image
  Accessible without login Image file tl.gif Icon Icon image
  Accessible without login Image file tm.gif Icon Icon image
  Accessible without login Image file tn.gif Icon Icon image
  Accessible without login Image file to.gif Icon Icon image
  Accessible without login Image file tr.gif Icon Icon image
  Accessible without login Image file tt.gif Icon Icon image
  Accessible without login Image file tv.gif Icon Icon image
  Accessible without login Image file tw.gif Icon Icon image
  Accessible without login Image file tz.gif Icon Icon image
  Accessible without login Image file ua.gif Icon Icon image
  Accessible without login Image file ug.gif Icon Icon image
  Accessible without login Image file uk.gif Icon Icon image
  Accessible without login Image file um.gif Icon Icon image
  Accessible without login Image file us.gif Icon Icon image
  Accessible without login Image file uy.gif Icon Icon image
  Accessible without login Image file uz.gif Icon Icon image
  Accessible without login Image file va.gif Icon Icon image
  Accessible without login Image file vc.gif Icon Icon image
  Accessible without login Image file ve.gif Icon Icon image
  Accessible without login Image file vg.gif Icon Icon image
  Accessible without login Image file vi.gif Icon Icon image
  Accessible without login Image file vn.gif Icon Icon image
  Accessible without login Image file vu.gif Icon Icon image
  Accessible without login Image file wales.gif Icon Icon image
  Accessible without login Image file wf.gif Icon Icon image
  Accessible without login Image file ws.gif Icon Icon image
  Accessible without login Image file xx.gif Icon Icon image
  Accessible without login Image file ye.gif Icon Icon image
  Accessible without login Image file yt.gif Icon Icon image
  Accessible without login Image file za.gif Icon Icon image
  Accessible without login Image file zm.gif Icon Icon image
  Accessible without login Image file zw.gif Icon Icon image

 Version Control Unique User Downloads Download Rankings  
 99%
Total:1,151
This week:1
All time:3,274
This week:149Up
User Ratings User Comments (4)
 All time
Utility:79%StarStarStarStar
Consistency:77%StarStarStarStar
Documentation:-
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:54%StarStarStar
Rank:1995
 
Class files is missing.
4 years ago (Matrix)
10%Star
there is no steps & library in folder
6 years ago (Brijesh Dhami)
0%Star
Does not work, because 2 database fields are missing.
7 years ago (manfred)
65%StarStarStarStar
great help traking users
7 years ago (Gerardo Rios RB)
80%StarStarStarStarStar
 
For more information send a message to info at phpclasses dot org.