|
|
 |
 |
 |
|
|
| Author Details |
Code Information |
|
|
|
Language
|
PHP (Hypertext Preprocessor)
|
|
Expires
|
Never
|
|
Length
|
551 Characters (24 Lines)
|
|
Password
|
no password
|
|
|
|
Description
in response to: http://www.coderprofile.com/source-code/328/simple-hit-counter
not tested this code.
<?php class hitCount { private $file = ''; function __construct($file) { $this->file = $file; } function getCount() { return intval(@file_get_contents($this->file)); } function addCount($count = 1) { file_put_contents($this->file, intval(@file_get_contents($this->file)) + $count); } function removeCount($count = 1) { file_put_contents($this->file, intval(@file_get_contents($this->file)) - $count); } } ?> <?php $counter = new hitCount('count.txt'); $counter->addCount(); print $counter->getCount(); ?> |
|
| Please login to post comments. |
|
|
I fixed up my counter.
haha, we did almost the same thing, using @file_get_contents, etc...
http://www.coderprofile.com/source-code/328/simple-hit-counter-v12
|
|
|
I am modifying that one to be better and more efficient. Thanks though :D
|
|
|
|
|
| |
 |
 |
| |
::
::
::
::
|
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved
|
|
|
|
|