Forum Moderators: DixonJones

Message Too Old, No Replies

List Current Users Accessing a File

         

Angela

3:11 pm on Jun 3, 2003 (gmt 0)



I have a collection of small image files in one directory on my website. I would like to create a page that will show how many people are currently viewing each separate image file, with the results displayed in a table that will update when the page is refreshed. I'm sure this is possible, but I'm not sure how to go about scripting the backend of this (I'm fine with html and js, just not so comfortable with server side stuff). I've already checked all over the web for a pre-built type script, to no avail. Can anyone help get me going in the right direction?

Thanks,
Angela

dmorison

3:23 pm on Jun 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Angela,

It would be reasonably easy to create a server side solution that showed how many times an image had been viewed in the past X minutes.

All the mainstream server side scripting languages have the ability to read local files - so you just point it at your log, read each entry for the last X minutes referring to the images in question and build up a tally.

I'm afraid you won't be able to get to the resolution of "currently viewing", since HTTP is stateless and you have no idea what the client is doing once you have served a page.

Hope this helps!

adds: for more help, it would be handy if you could say what server side resources you have - what server you are on, whether you have access to the config files etc..

Angela

6:34 pm on Jun 4, 2003 (gmt 0)



Hmmm... not sure if that would help me exactly. What I really need is some way to show how many people are currently viewing a file or page, rather than just having recently accessed it. Perhaps there is a better way to approach this.

What I am specifically trying to do is offer a small group of people, who have webpages on various servers, a central page where they can see how many people are currently viewing their (and each other's) pages. I took a look at some webtrend tags and noticed that they are able to track usage by having the pages in question include a small gif file that they track on their server. This seemed like the easiest solution, but I didn't realize that it can't show when people stop viewing the page.

I've seen a few scripts that show how many people are currently online at a specific site. Is there any way to get those scripts to show pages hosted on other servers? I understand that the pages referenced would have to have some sort of tag added to them for this to work, and that should be acceptable to the people involved.

As far as the server side resources I have... I'm using EasyCGI's intermediate hosting plan (http://www.easycgi.com/hosting_comparison.html - I figured it would be easier to let you see the whole setup this way rather than listing everything.)

Thanks!
Angela

Gibble

6:39 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



All those scripts that show "X number of users online" use a time limit, if a person hasn't accessed the page in the last 5 minutes (or whatever) they are considered gone and no longer viewing, they may still actually be there, or they may not, they are really just showing that X number of users have been there recently, but they don't say that.

Like dmorison said, because HTTP is stateless, you can't show who is actually viewing at any given time.

kevinbb

6:18 am on Jun 5, 2003 (gmt 0)



I don't know CGI.

I checked your plan and it does allow ASP. I wrote a photo album in ASP and when you go to a gallery (like sequoia below) it shows all the thumbnails. You then click on a thumbnail to view the larger picture, the link attached to the thumbnail is as follows:

[example.com...]

Since clicking on a thumbnail runs ASP script, I could easily add a routine to write the following to a text file: Requester's IP [Request.ServerVariables("REMOTE_HOST")], Time, and Filename. You can then have an admin frontend ASP page that will read this text file and summarize the info for you. I'd put a time limit of 15 minutes to time-out the picture viewing (incase the viewer simply exited the browser) ... or when the user went to another picture.

I suppose you could use a FORM instead of clicking on the thumbnail if you wanted to use a button, your method=POST, ACTION=somepage.asp