hey there, i have recently created a login/registration script and on my admin screen i'd like to show "users currently logged in" along with what page they are viewing. i'm using sessions but not using session id's in the cookie or anything that auto logs a person back in. is there a way to show all sessions? i have no clue on how to show users currently logged in for admin purposes.
thanks.
php/mysql show logged in
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Each time a user loads a page store in a database the page they loaded, the time, username, IP etc. Then you can just print this info on your page. Of course only keep one record per username.
When displaying the page you can then just call the info from the database where the last page loaded time is without a certain time out value - like 5 mins.
You can then also use this to see the last time a user was seen - which can help you if you ever need to remove inactive users from the site.
When displaying the page you can then just call the info from the database where the last page loaded time is without a certain time out value - like 5 mins.
You can then also use this to see the last time a user was seen - which can help you if you ever need to remove inactive users from the site.
-
Straterra
- Forum Regular
- Posts: 527
- Joined: Mon Nov 24, 2003 8:46 am
- Location: Indianapolis, Indiana
- Contact:
Then arises this simple problem : What if there are guests? How do I show people who aren't guests? 1 solution to this is to assign the guest a unique guest-only cookie. Then, use the quest's IP to assign uniqueness to it in the database. From there, it shouldn't be hard to tell how many guests you have on your site. ^_^
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
NEVERMIND--i figured it out.. DOH.. create another table frigg'n DOH!kettle_drum wrote:Each time a user loads a page store in a database the page they loaded, the time, username, IP etc. Then you can just print this info on your page. Of course only keep one record per username.
When displaying the page you can then just call the info from the database where the last page loaded time is without a certain time out value - like 5 mins.
You can then also use this to see the last time a user was seen - which can help you if you ever need to remove inactive users from the site.
geez, what am i smok'n. must be crack.