3
Contributors
9
Replies
11
Views
5 Years
Discussion Span
Last Post by mikulucky
0

i need the php code to do that function .i have a list of registered members in my database out of them how to know which uer is currently in my site.session_start() of php do this ?or not.if we set $_SESSION then is there any possibility to know which users are currently online?

0

If they have to login, then you can store that user in a session. If you want an overview of all the people online, you may want to store that in the database.

0

how to store all those session variables.i don't understand u clearly when person is logged in in my code i store his userid in session variable but i dn't know exactly where this details about sessio variable will be stored i think they will be stored in users hard disk and how to store this session variables in my database?

1

If they have to login, then you can store that user in a session. If you want an overview of all the people online, you may want to store that in the database.

What pritaeas means is when you user logs in, then there would be an extra column in your table for your users called for example active. When the user logs in then your log in script will update this field to 1, then when the user logs out it could change it to a 0.

Even better would to be to have another column as well as the above which has an expire time, so when the user logs in it is set to active, and the expire time is set to the same as the death of the cookie. This means that you can have another script that checks this table updating all the statuses of the users who are marked as active however the expire time has passed.

Well that is a bit more detail, but all credit goes to @pritaeas for solution.

Votes + Comments
Thanks for explaining ;)
0

my doubt is all about how to activate the active variable in database means i could we know user is accessing my site.sorry if i am disgusting you plzz dn't mind and help me.

0

sorry if i am disgusting you plzz dn't mind and help me.

Don't worry we can't all know everything, although it would be nice :)

Here is it briefly:

Well if the user has logged in then they are active? At the time of activating the member login, update the table in the database. Then when they log out they are not active so update the database table to reflect this.

What is it you do not specifically understand? And we can do each step at a time.

0

Ok that is great to hear, could you please mark the thread as solved, and give rep to the people whom helped. Glad we could help :)

Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.