|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
registered members currently online?
i need a code that shows how many registered members I have online on my homepage,like this
We have 10,883 members 1 is online now 19 guests are visiting table structure is :: $table = "CREATE TABLE users ( id int(10) DEFAULT '0' NOT NULL auto_increment, username varchar(40), password varchar(50), regdate varchar(20), email varchar(100), website varchar(150), location varchar(150), show_email int(2) DEFAULT '0', last_login varchar(20), PRIMARY KEY(id))"; |
|
#2
|
||||
|
||||
|
How about making an online field... set it true when they log in and false when they log out... then you can just query the database accordingly...
only problem being not all users log out properly... not sure how you would handle that... |
|
#3
|
||||
|
||||
|
Or you could just do a count where the UNIX_TIMESTAMP() of last_login plus, say, 300 is less than time(), giving you a count of people who have logged in within the last five minutes. Or use that in conjunction with the login/logout flag MadCowDzz mentioned. As for total members, just get a count of the users table. This'll probably have to be a second query. And as for guests, unless you log every hit in another table, I can't think of a good way to count those who haven't logged in.
|
|
#4
|
|||
|
|||
|
tnx !!
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > registered members currently online? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|