This PHP counter is a simple yet effective PHP text hit counter. It uses a flat-text database so no SQL databases are necessary. It can count hits for multiple pages of your website or even websites on other servers. It can be configured to count every reload visits. The count is displayed on the page using a simple PHP code. The script prints out only the number (i.e. 15344) which you can easily format with HTML code. You can use one copy of the script to count hits on several pages.
Now there are many snippet available online or on many others Blog and website but everyone is not able to optimize your blog or website so you need some optimized code snippet. So now check out code snippet for your blog and website that will give you all features for your desired code. Now grab the ready to use code and paste it where you want.
Table of Contents
Features:
1.) No JQuery/JavaScript File Added.
2.) Pure Little PHP Code Added.
3.) No Database Added.
4.) Simple And Fast Loading Snippet.
5.) Can Work With Any Browser.
How To Add In A WebPage OR Blog?
1.) Just Go To Your “Web Page File” or “Blog” PHP Page.
2.) Now “Copy” The Below Codes And “Paste” It To Their Positions.
<?php $handle = fopen("counter.txt", "r"); if(!$handle){ echo "Could not open the file" ; } else { $counter = ( int ) fread ($handle,20) ; fclose ($handle) ; $counter++ ; echo" <p> Visitor Count: ". $counter . " </p> " ; $handle = fopen("counter.txt", "w" ) ; fwrite($handle,$counter) ; fclose ($handle) ; } ?>
Customization:
1.) You do not have to change anything. Rest can ask for customization.
Last Words:
That’s all we have. If you have any problem with this code in your template then feel free to contact us with a full explanation of your problem. We will reply to you as time allows us. Don’t forget to share this with your friends so they can also take benefit from it and leave your precious feedback in our comment form below. Happy blogging, See you in next article…
Be the first to write a comment.