Simple Text Counter (php)

Here is a simple php counter in text mode.
All you need to change just permission file count.txt

code:

Simple Text Counter

if (file_exists('count.txt'))
{
$fil = fopen('count.txt', r);
$dat = fread($fil, filesize('count.txt'));
echo "";
echo $dat+1;
echo "
";
fclose($fil);
$fil = fopen('count.txt', w);
fwrite($fil, $dat+1);
}

else
{
$fil = fopen('count.txt', w);
fwrite($fil, 1);
echo '1';
fclose($fil);
}






Copy and paste the code to your php page, create count.txt file and change permission as needed
Have fun..

0 comments:

Post a Comment

Related Articles