Jump to content
xisto Community
cragllo

Php Hit Counter record your visitors...

Recommended Posts

All you do is copy this code into the page you want to display it on.

<?php$counterfile = "counter.txt";$counter = file("$counterfile");$c = $counter[0];if (strlen($c) == 0){$c=0;}$c=$c+1;$a = fopen("$counterfile", "w");fwrite($a, $counter = "");fputs($a, $c);fclose($a);echo ("$c");?>
Make a file called 'counter.txt' in the same directory as the page the code is on.
Remember to CHMOD your txt file to 666. (change the permissions to 666)

Share this post


Link to post
Share on other sites

Wow thats even better than the other tutorial I read on this site. Thanks for making such a simple PHP counter. You could explain what each function does, but otherwise, great job.

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

×
×
  • 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.