Jump to content

PHP session


thetwai

Recommended Posts

[!--quoteo(post=357532:date=Mar 23 2006, 09:50 AM:name=thetwai)--][div class=\'quotetop\']QUOTE(thetwai @ Mar 23 2006, 09:50 AM) [snapback]357532[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I need to get how many session my server currently has?
Is there anyway to get the session count?

The problem is I want to know who is online on my site.
Please Help me

TW
[/quote]

you COULD count the number of files in the session folder on your server, but you wouldnt really be able to determine who of your registered users is online.
to do that, you'd need to create a custom session handler. the code could drag on, but this will give you an idea how it works.
1, each page in your site should 'include' a sessions.php (or whatever you decide to call it) script, with the session handling functions.
2, the sessions.php file will update the 'last active' field in your mysql sessions table with the current time. also, it will automatically delete records from the table who's last activity was over a certain time. if the users session does not exist in the table, create it.
3, on your 'who is online' page, all you need to do is read and display all of the records from your sessions table.
Link to comment
Share on other sites

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.