Simple PHP Visitor Counter: Count and display the visits that site pages had

Recommend this page to a friend!
  Info   View files Documentation   View files View files (18)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2021-08-23 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 119 This week: 2All time: 9,306 This week: 105Up
Version License PHP version Categories
simple_counter 4.0.3GNU Lesser Genera...7.0.0Statistics, User Management, PHP 7
Description Author

This class can count and display the visits that site pages had.

It uses local files to track the count of unique users that visit a given page.

A user is determined to be unique based on the device's IP address that is used to access the page. Private IP addresses are ignored.

The package uses file locks to prevent simultaneous accesses from corrupting the file on which the user counting is stored.

It can also display the current page user visits count using an image or a text message.

Picture of Eric Sizemore
  Performance   Level  
Name: Eric Sizemore <contact>
Classes: 7 packages by
Country: United States United States
Age: 34
All time rank: 15318 in United States United States
Week rank: 67 Up6 in United States United States Up

Details

Simple Counter - Website visitor counter.

Simple Counter is a simple PHP counter that counts your website visitors. It has the ability to either show the count as plain text or images; and whether or not to count only unique hits, or all hits. (IP Based)

Small Note

This code is many years old (first started in 2006). I am in the process of bringing it into the modern world, and that includes the documentation. I am working on it, I promise. ;)

Installation

To install Simple Counter:

  1. Open 'counter.php', configure the settings near the top of the script.
  2. Create a new folder, named 'counter'.
  3. Upload 'counter.php', 'index.html', and the 'logs' directory in ASCII mode.
  4. Upload the 'images' folder in BINARY mode.
  5. CHMOD the 'counter.txt' and 'ips.txt' files to 0666 (if required). They are located in the 'logs' folder.

Usage

Usage is fairly simple once installed. Simply add the following code to the page where you want the counter to be shown:

<?php include './counter/counter.php'; ?>

About

Requirements

  • Simple Counter works with PHP 7.0.0 or above.

Submitting bugs and feature requests

Bugs and feature requests are tracked on GitHub

Issues are the quickest way to report a bug. If you find a bug or documentation error, please check the following first:

  • That there is not an Issue already open concerning the bug
  • That the issue has not already been addressed (within closed Issues, for example)

Contributing

Simple Counter accepts contributions of code and documentation from the community. These contributions can be made in the form of Issues or Pull Requests on the Simple Counter repository.

Simple Counter is licensed under the GNU LGPL v3 license. When submitting new features or patches to Simple Counter, you are giving permission to license those features or patches under the GNU LGPL v3 license.

Guidelines

Before we look into how, here are the guidelines. If your Pull Requests fail to pass these guidelines it will be declined and you will need to re-submit when you?ve made the changes. This might sound a bit tough, but it is required for me to maintain quality of the code-base.

PHP Style

Please ensure all new contributions match the PSR-2 coding style guide. The project is not fully PSR-2 compatible, yet; however, to ensure the easiest transition to the coding guidelines, I would like to go ahead and request that any contributions follow them.

Documentation

If you change anything that requires a change to documentation then you will need to add it. New methods, parameters, changing default values, adding constants, etc are all things that will require a change to documentation. The change-log must also be updated for every change. Also PHPDoc blocks must be maintained.

Branching

One thing at a time: A pull request should only contain one change. That does not mean only one commit, but one change - however many commits it took. The reason for this is that if you change X and Y but send a pull request for both at the same time, we might really want X but disagree with Y, meaning we cannot merge the request. Using the Git-Flow branching model you can create new branches for both of these features and send two requests.

Author

Eric Sizemore - <admin@secondversion.com> - <http://www.secondversion.com>

License

Simple Counter is licensed under the GNU LGPL v3 License - see the LICENSE file for details

  Files folder image Files  
File Role Description
Files folder imageimages (11 files)
Files folder imagelogs (3 files)
Accessible without login Plain text file COPYING Data Auxiliary data
Accessible without login Plain text file COPYING.LESSER Data Auxiliary data
Plain text file counter.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  images  
File Role Description
  Accessible without login Image file 0.gif Icon Icon image
  Accessible without login Image file 1.gif Icon Icon image
  Accessible without login Image file 2.gif Icon Icon image
  Accessible without login Image file 3.gif Icon Icon image
  Accessible without login Image file 4.gif Icon Icon image
  Accessible without login Image file 5.gif Icon Icon image
  Accessible without login Image file 6.gif Icon Icon image
  Accessible without login Image file 7.gif Icon Icon image
  Accessible without login Image file 8.gif Icon Icon image
  Accessible without login Image file 9.gif Icon Icon image
  Accessible without login Image file spacer.gif Icon Icon image

  Files folder image Files  /  logs  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file counter.txt Doc. Documentation
  Accessible without login Plain text file ips.txt Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:119
This week:2
All time:9,306
This week:105Up
For more information send a message to info at phpclasses dot org.