[Guide] PHP Counter

Bupyc™

New Member
Joined
Jul 10, 2008
Messages
504
Reaction score
327
Hello, this is Web Counter , hе show all impression , and not restart :)

Guide:
1. Create file. Counter.php With text:

PHP:
<?
$digits = 6;
$filelocation="counter.txt";
if (!file_exists($filelocation)) {
$newfile = fopen($filelocation,"w+");
$content=1;
fwrite($newfile, $content);
fclose($newfile);
}
$newfile = fopen($filelocation,"r");
$content = fread($newfile, filesize($filelocation));
fclose($newfile);
$newfile = fopen($filelocation,"w+");
$content++;
fwrite($newfile, $content);
fclose($newfile);
echo "We have ".sprintf ("%0"."$digits"."d",$content)." Impression";
?>

2. Create .txt file with name counter
3. Go to index and paste this Where you want :
PHP:
<?
include ("counter.php")
?>

4. Result: We have 008064 Impression




Credits: WebTourist
Some update Bupyc
 
Last edited:
  • Like
Reactions: DarkWeed and root
Нещо си объркал кода....


Или горе трябва да се казва broyach.php или долу в include да е counter.php ;):
 
нещо си объркал кода....


или горе трябва да се казва broyach.php или долу в include да е counter.php ;):

моя грешка, оправено е
 
Стига copy/paste от "Туриста"! +това темата не е за тук...
 
  • Like
Reactions: NikeR

Similar threads