#native_company# #native_desc#
#native_cta#

ReCount

By Reed Williams
on April 30, 2003

Version: 0.1 beta

Type: Function

Category: HTTP

License: GNU General Public License

Description: A simple PHP counter.

<?php // opens the php document

/*
***************************************************
* recount v 0.1 beta                              *
* Created by Reed Williams ([email protected])    *
* Source last updated: 2003.04.30 11:00 pm        *
***************************************************
*/

$file = "count.txt"; // sets the file where the count will be located
$counter = file("$file"); // makes the script read the text file
$r = $counter[0]; // sets $r to the number in the counter file
if (strlen($r) == 0) {$r=0;} $r=$r+1; // if the string length of the count is zero it will add one
$e = fopen("$file", "w"); // opens the file and sees if it is writable
fwrite($e, $counter=""); // erases the count in the file
fwrite($e, $r); // writes the new count to the file
fclose($e); // closes the file
echo("$r"); // shows the file
?>