Code Snippet </> Info
Snippet Name: Really Simple Counter
Description: This is a super simple page counter.
Note: Be sure to read instructions, create a file named ' counter.dat ' and change the path location accordingly.
Author: Ronan Spoor <ronan@keykoder.co.uk>
Last Modified: 2019-12-13 01:28:52
Language: php
Highlight Mode: php3
|
Copy Codes: Use Free Notepad ++ |
|
Snap HTML Code Editor: Paste the source code, make changes and instantly see it in live preview. Snap HTML Code Editor
|
|
Copied To Clipboard!
<?php
// Name: Really Simple Counter Version 1.1
// Creator: Ronan Spoor - ronan@keykoder.co.uk
// Script found at https://snapbuilder.com code library
// Thanks - Ronan
// ------------------------------------------------
//
// Instructions:
// Include this file in any page you want the hit counts
// recorded on and in the place you want it to be shown.
// Sample:
// include ("count.php?show=true");
//
// If you don't want the hit count to be printed out then use this code.
// Sample:
// include ("count.php");
// ------------------------------------------------
// 13.03.2003 Markus Graf <gurix@web.de>
// still more simply
// ------------------------------------------------
$file = "/tmp/counter.dat"; // change this to the location of your counter file ????
$count = implode('',file($file)) + 1;
if(!($fp = fopen($file, "w"))) die ("Cannot open $file.");
fwrite($fp, $count);fclose($fp);
if ($_REQUEST["show"]) echo "You're visitor Number <b>$count</b>.";
// ------------------------------------------------
?>H!
|