Jump to content
xisto Community
Sign in to follow this  
Corey

Simple Php Counter Script How to make a simple php counter script

Recommended Posts

In this tutorial i will explain how to make a simple script writen in PHP...that uses .txt file.

<?php// script writen by tema$a = fopen ("count.txt", "r"); // 1.$bytes = 4;         $x = fread($a, $bytes); // 2.$y=$x + 1;                   // 3.$fp = fopen ("counter/count.txt", "w+");  // 4.fwrite ($fp, "$y");     // 5.fclose ($fp);                // 6.echo "Posjeta:$y";                // 7.?>

1. selecting a file which the script is going to use for counting visits.
2. reading from the script
3. adding 1 to the number in the .txt file.
4. opening the .txt file again
5. writeing the new number in the .txt file
6. closeing .txt file
7. writing the number from the .txt file

...you have to include this file somewhere on the start page..,


here are all the script files...for download
http://forums.xisto.com/no_longer_exists/
http://forums.xisto.com/no_longer_exists/


if you have some questions about this script post them here,,,...

Share this post


Link to post
Share on other sites

Very nice script, simple one, but there is one workaround needed. Relative path in line 1 and 4 isn't same. I guess we need to delete "counter/". It worked like a charm, needed 3 minutes to install it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.