I need PHP Visitor Code | Sololearn: Learn to code for FREE!


I need PHP Visitor Code

This is my website, which is created 1 week ago. https://Crazycoding.epizy.com/Sabshow/sabshow.php I want to knew how many people visit my website ? Anybody have code ? So we can compute , how many people/visitor will be visit my website ?

4/7/2021 11:47:41 AM

Sajid Ali

3 Answers

New Answer


Found something helpful ig 🙂 https://www.ionos.com/digitalguide/websites/website-creation/create-your-own-visitor-counter-how-it-works/


Hi! required php code? for this, you can use the ready-made visitor counter for example from known portals or search engines. it is not necessary to write it yourself. enough to place the counter code on your page below


Disclaimer: I'm not a PHP person (PH-Person?), so I cannot help you with specific PHP code. However, there's a few things you'll need to keep in mind. Firstly, how exactly do you want to keep track of what a unique visitor is? You could do: - Simple page visits (i.e., every time a user visits mywebsite.com/home, increment the counter) - Unique IP address: check out https://stackoverflow.com/questions/13646690/how-to-get-real-ip-from-visitor, and increment the counter every time you get a new IP address. Look into the "set" data structure to see how to check for uniqueness. Either way, you'll need to find some way to store this on the server. In particular, you'll need a global (or semi-global variable) to store a "currentCount". Here's some (JavaScript-ish!) pseudocode: router.on(incomingMessage).do(function(newMessage){ if(newMessage.ip.isUnique()){ globalCounter++; } })