Lola777 Posted July 6, 2018 Share Posted July 6, 2018 (edited) Hello , I am looking for a simple code to install which gives me the number of person in real time of person currently on the page. I'm looking for a while but I find no functional code. Thank you for your help Edited July 6, 2018 by Barand Reduce shout volume in title Quote Link to comment https://forums.phpfreaks.com/topic/307449-current-counter-currently-my-page/ Share on other sites More sharing options...
ginerjm Posted July 6, 2018 Share Posted July 6, 2018 You want to know how many people are using a certain page at any given time? YOu could do that by directing all of your requests thru a main script that then counts how many times a specific page/script is requested. Problem with that is how do you propose to remove a count when the user closes the browser. Do you want to know how many times a page is used within a certain time period perhaps? This counter mechanism would have to use a db table since you can't store the numbers in a session var. Quote Link to comment https://forums.phpfreaks.com/topic/307449-current-counter-currently-my-page/#findComment-1559312 Share on other sites More sharing options...
Lola777 Posted July 7, 2018 Author Share Posted July 7, 2018 Hello, I would like. that every 30 seconds the counters this refresh. the counter gives me the number of people currently on the html page. without having to identify with anything. just be present on the page. I would like the simplest possible code without having to interact with a database. Quote Link to comment https://forums.phpfreaks.com/topic/307449-current-counter-currently-my-page/#findComment-1559342 Share on other sites More sharing options...
gizmola Posted July 7, 2018 Share Posted July 7, 2018 And what do you want to do with this count? Realistically, your count will never be more than 1 (unless you are being visited by a bot). Very few sites have significant traffic without having been around for a long time, or having had a significant advertising and marketing budget or some other phenomenon that is attracting visitors and traffic. The simplest way to see what is going on is also 100% free to you -- Google Analytics. Just hit Analytics for your site and click on Real time. Quote Link to comment https://forums.phpfreaks.com/topic/307449-current-counter-currently-my-page/#findComment-1559344 Share on other sites More sharing options...
Lola777 Posted July 8, 2018 Author Share Posted July 8, 2018 Hello, I would like. that every 30 seconds the counters this refresh. the counter gives me the number of people currently on the html page. without having to identify with anything. just be present on the page. I would like the simplest possible code without having to interact with a database. Quote Link to comment https://forums.phpfreaks.com/topic/307449-current-counter-currently-my-page/#findComment-1559399 Share on other sites More sharing options...
ginerjm Posted July 8, 2018 Share Posted July 8, 2018 (edited) Why are you repeating yourself? You were given everything you asked for - just not the way you expected it. What you are asking as I said previously is very complex. You do realize that when a page is requested by an html request from a site visitor that starts a task which generates the page and sends it to that client and the task then goes away. You yourself now have no way of knowing that that client ever made a visit to your site unless your task DID SOMETHING to register that visit. That's a db usage which you don't seem to want to do. And just how does "the counters this refresh" occur? Do YOU run a script every 30 seconds to see what the counts are on YOUR client screen? To me it sounds like a place for a cron job (look it up) that happens every 30 secs and saves the resulting counts along with a a datetime value in a db table where you can then review it at any time you want to and have a delete button to clear the old data out as you wish. Edited July 8, 2018 by ginerjm Quote Link to comment https://forums.phpfreaks.com/topic/307449-current-counter-currently-my-page/#findComment-1559445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.