Welcome Guest, Not a member yet? Register   Sign In
How to display if a user is online?
#1

[eluser]Tyler Diaz[/eluser]
I'm currently experimenting with Code igniter (and PHP) and I am trying to build a simple forum system.

I was wondering how do developers do to show if a user is online or offline on topics and profile. I am using http://dialect.ca/code/ci-simple-login-secure/ - Simple login secure to do the basic login job for me along with using the Code igniter custom session database.

So any leads, tips, advice, snippets, help on how this technique is achieved?
#2

[eluser]Michael Wales[/eluser]
Update a field in the table with the timestamp of the last action, if timestamp is within X minutes of now() that user is online.
#3

[eluser]Tyler Diaz[/eluser]
Awesome, thank you so much MIchael. Such a basic concept.

Would you recomend a page refresh and action? Or would that put far too much server strain on the database?
#4

[eluser]Michael Wales[/eluser]
Not sure I understand what your question is... essentially, on every single page if a user is logged in you will do:

Code:
'UPDATE user SET last_action = '2009-07-13 16:50:00' WHERE id = '1'
#5

[eluser]Tyler Diaz[/eluser]
The example you provided answers the question anyway.

I really appreciate the friendly and rapid assistance overall - Thank you.




Theme © iAndrew 2016 - Forum software by © MyBB