Jump to content

Recommended Posts

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.

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.

 

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.

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.

 

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 by ginerjm
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.