![]() |
Count multiple users on same account
Hi!
I have a website for the area where I live, and people don't have an own account, they use a single account. So all of the people uses the same account. How would I be able to record how many people are online on that account at the same time, and how many people that have been online at the same time at the most.. I'm open for pretty much any suggestion.. Thanks in advance! |
I'd give every single person who visits a unique cookie and when they login record it, then it's just a matter of
SELECT `unique_cookie_id` WHERE `u_id`=%d |
Not really, because it will recognize everyone as different whenever they log in again.
|
You could just regenerate the cookie if it exists already.
|
Quote:
Quote:
|
Not exactly, Village made a point from my lack of proper wording. Example:
PHP Code:
|
Quote:
|
No, I meant the query to check if the ID has already been used.
|
Quote:
|
do this
add a new column to the userlogin table named ip then grab the users ip address who logs in and save it into the table. then for every page visited if your using either cookies or sessions check to see if the userlogin that is being used matches the existing ip address in the database. if the user decides to log out , still keep that ip address in the databse. when the user tries to re-login and his ip address is different than the one existing in the database, tell the user that they must change their password because they are logging in from a computer that wasnt used when the last user logged in. so every time a user logs in and his ip doesnt match the one existing in the database they gotta change the password, this eventually gets on everyones last nerve and the users who dont have logins will eventually either quit or get their selves their own logins. if you want the code on how to do all this, let me know i'll type it out. |
Quote:
I want to record how many people are online on THAT SAME ACCOUNT at the SAME TIME. |
I might be asking a dumb question but why on earth would you allow many people to log in to your site using a shared user account in the first place?
|
Im wondering the same thing Salathe is...
Id simply make a table "loggedin" with coloums "username" "ip" "date" when they login just add that there, you can make date the date and the hour or something, then just search for that username and the date your in Example: date('d-m-Y-G') blayne4k 127.0.0.1 04-28-08-10 blayne4k 127.0.0.2 04-28-08-10 blayne4k 127.0.0.1 04-28-08-11 select only the ones from that day and hour, and group by username, put a count on it and you can see how many people login that hour |
Because, this is not someplace where everyone will be able "register". This is a closed community just for the area where I live, it's like.. think of it as a guild :-P And most of the people who live here are like 60y.o and have barely knowledge of logging into the fking site xDD So that's why they have a shared user..
|
I could just see your login page
Username: Password: Real Name (Yes, we know its not the maker): |
Excuse me? :-P What? xD
|
What's the point of having a user system for them then? Just make a guest-account system where they enter their "Guest Name" when they do things xD
|
Quote:
And I want to be able to record how many of them are online on that account at the same time :P |
Use .htpasswd to protect the site, and record ip/user agent combinations to determine who's online.
|
| All times are GMT. The time now is 12:39 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0