Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 4 of 4

This is a discussion on Session path and number of sessions in the Shared & Semi-Dedicated forum
Hello All... I copied a script from the web that counts how many sessions exist so that i can know/show how many users are connected ...

  1. #1
    JPC Member
    Join Date
    Mar 2004
    Location
    Lisbon / Portugal
    Posts
    25

    Session path and number of sessions

    Hello All...

    I copied a script from the web that counts how many sessions exist so that i can know/show how many users are connected to a particular page.

    I used it at my own site (Name the Game) and despite the fact that i was the only one there i received a value of "77".

    Another thing is that using this on my own pc with APACHE i get the value correct. i double checked since i can go to the session path directory and see how many files are there, strangely on JAG server i to the directory the script says reports as being where the JAG keeps theyr sessions (/tmp) thought the use of "sessions_path()" and i go there are there arent any (ses*.*) files there.

    So my question is, why did i receive 77 sessions if only i was at the site (which im sure due to the fact that it has a strange url hehehehe), and in which (directory) can i (visually) check the existing sessions? and if possible how to clean the sessions that are there (though PHP) in case there are 77 of them.

    Is there a better way to know exactly how many users are online on my webpage? I can check the loged in from my Mysql table field (loged) despite the fact that if they close the explorer i cant 'logout' them, and they still remain there, so i added a timer and after 1 minute all users that are connected are disconected and if necessary reconnected through a cookie.

    Well this is all i learned a few days ago, so probably im talking rubish.

    Can anyone also tell me the best way/script to check the number of online visitors/registered users for a particular website?

    Thanks in advance,
    RootShell

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Without seeing your code it is hard to say exactly what is happening, but I'm giving it my best guess. You might be getting the count of all sessions on your server, not just the count for your site. All sites on your server are configured to use /tmp for session data, so you'd probably need to do a little more work to figure out the number of sessions for only your site.

    You might want to try changing the directory where session data is written to a path in your account space. To do that:

    1. Create a new directory at the top level of your account (NOT inside public_html). You can name it whatever you want, tmp or sessions would be a good name (I'll assume tmp for the rest of this tutorial).

    2. Chmod this directory to 777.

    3. Edit your site's public_html/.htaccess file (or create it if you don't have one already) with the following line:

    Code:
    php_value session.save_path /home/USERNAME/tmp
    (replace USERNAME with your username and tmp with whatever you chose when you created the directory).

    4. Now try your site. Session files should be saved in your account space now instead of in the system wide /tmp directory.

    Hope this helps. If not, maybe you could post some of your code (or PM it to me if you'd prefer). I've never tried to make an "active user counter" before, so this is kind of new territory for me.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    JPC Member
    Join Date
    Mar 2004
    Location
    Lisbon / Portugal
    Posts
    25

    Sessions

    Well that seems to be a good solution for my problem, will try it later on.

    BTW, you mentioned that "I've never tried to make an "active user counter" before, so this is kind of new territory for me." and my question is: why not?

    since i think it's quite interesting to let users know how many others are visiting their site.

    maybe you could have a go at it? and then 'share' your code? hehehehe i can send you the code that i used for my test if you want to (my email rootshell@netcabo.pt) send me a email.

    Bye,
    RootShell
    (PORTUGAL Euro2004 Champion)

  4. #4
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003

    Re: Sessions

    Originally posted by RootShell
    ...and my question is: why not?
    Well, most of the sites that I build aren't the types of site where users interact with each other. For example, visitors to my business site, www.interbrite.com, could probably care less how many other people are looking at the site at that time. They're more interested in seeing how my services could fill their needs. For me, total traffic counts, by day, week, or month are more beneficial than knowing how many visitors I have at a particular instant.

    If I were building a user community of some sort I'd probably want to build in such a feature. For example, I think the "users browsing this forum" thing on here is kind of cool, especially in the areas where our discussions get heated, but for most types of sites it isn't very useful.

    If you want to PM me you code to look for specific problems, feel free. I'm always willing to help out. But I don't see myself writing such a system right now. I just don't have the time right now to take on a project wich is of no use or benefit to me. Sorry.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •