Jump to content

Users Online Type Thing


Recommended Posts

Hi, I am creating a forum and I was wondering how I could create a users online legend at the bottom of the index. I tried something like echo "$myusername" and it will only display your username. How could I accomplish this?



Link to comment
Share on other sites

Since I don't know the structure of your forum, I can't quite say. But the basic idea would be to have a column in your users and/or sessions table named $logged_in, and the only values would be 1 for true and 0 for false. Then, run a mysql_query on the table WHERE logged_in = 1.

Link to comment
Share on other sites

Let's say you wanted to log a user out after 10 minutes. Create a new function named whatever you want, and a new column in the table named something like last_activity and set the type to timestamp. In the function, use strtotime to check when the user was last active, and if that was more than 10 minutes ago, unset the session for that user. Put the function in a file, and include/require that for every secure page.


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.

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.