I need PHP Visitor Code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

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 ?

7th Apr 2021, 11:47 AM
Sajid Ali
Sajid Ali - avatar
3 Answers
7th Apr 2021, 11:50 AM
Genuine Stalwart
Genuine Stalwart - avatar
+ 2
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
7th Apr 2021, 12:00 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
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++; } })
7th Apr 2021, 2:07 PM
HealyUnit
HealyUnit - avatar