Programming :  Student Freelance Forum For Work Experience Builders' (CertificationPoint) The fastest message board... ever.
 
PHP-Counter
Posted by: adcertpoint (Moderator)
Date: April 29, 2020 04:29PM

By Gary Jones

on March 21, 2004

-
Version: 0.3

Type: Full Script

Category: Other

License: GNU General Public License

Description: Yes theres alot, but this ones object oriented!





?


class counter {
var $file = 'hits.txt'; // Rename this path/to/file to your choosing - it will store the data.
// Best to create file first, with 777 permissions.
function counter()
{
$this->readFile();
$this->writeFile();
}

function readFile()
{
$hiti = fopen($this->file, "r"winking smiley;
while(!feof($hiti)){
$this->$hits .= fgets($hiti,128);
}
$this->$hits=1+$this->$hits;
echo $this->$hits;
fclose($hiti);
}

function writeFile()
{
$hito = fopen($this->file,"w+"winking smiley;
fputs($hito,$this->$hits);
fclose($hito);
}

}
// Usage
// $count = new counter;

Options: ReplyQuote


Sorry, only registered users may post in this forum.
This forum powered by Phorum.