 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
 |
|
 |
04-27-2008, 09:53 AM
|
#1 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
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!
__________________
|
|
|
|
04-27-2008, 02:09 PM
|
#2 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 264
Thanks: 2
|
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
__________________
"What everyone seems to forget is that while knowledge certainly is something - it's the implementation of knowledge that brings power" - Andres Galindo.
|
|
|
|
04-27-2008, 02:28 PM
|
#3 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
Not really, because it will recognize everyone as different whenever they log in again.
|
|
|
|
04-27-2008, 04:25 PM
|
#4 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 264
Thanks: 2
|
You could just regenerate the cookie if it exists already.
__________________
"What everyone seems to forget is that while knowledge certainly is something - it's the implementation of knowledge that brings power" - Andres Galindo.
|
|
|
|
04-27-2008, 04:50 PM
|
#5 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by TlcAndres
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
|
That's kinda smart.. but set a cookie EVERY time they visit ?
Quote:
Originally Posted by Village Idiot
Not really, because it will recognize everyone as different whenever they log in again.
|
Didn't understand this.. :/
__________________
|
|
|
|
04-27-2008, 05:00 PM
|
#6 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 264
Thanks: 2
|
Not exactly, Village made a point from my lack of proper wording. Example:
PHP Code:
ob_start(); if(!isset($_COOKIE['seperate'])){ $value = md5(time()); //check if it's already in there...its unlike but I don't do chance $query = mysql_query($query)); //I assume you know how to do it. $results = @reset(mysql_fetch_assoc($query)); if($results == ''){ setcookie('seperate',$value,time() * 360000); } }
Browsers expire cookies so I'd suggest regenerating the cookie on login along with recording it.
__________________
"What everyone seems to forget is that while knowledge certainly is something - it's the implementation of knowledge that brings power" - Andres Galindo.
|
|
|
|
|
The Following User Says Thank You to TlcAndres For This Useful Post:
|
|
04-27-2008, 07:05 PM
|
#7 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by TlcAndres
Not exactly, Village made a point from my lack of proper wording. Example:
PHP Code:
ob_start();
if(!isset($_COOKIE['seperate'])){
$value = md5(time());
//check if it's already in there...its unlike but I don't do chance
$query = mysql_query($query)); //I assume you know how to do it.
$results = @reset(mysql_fetch_assoc($query));
if($results == ''){
setcookie('seperate',$value,time() * 360000);
}
}
Browsers expire cookies so I'd suggest regenerating the cookie on login along with recording it.
|
Actually, I have never before in my life dealt with cookies..  
__________________
|
|
|
|
04-27-2008, 07:30 PM
|
#8 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 264
Thanks: 2
|
No, I meant the query to check if the ID has already been used.
__________________
"What everyone seems to forget is that while knowledge certainly is something - it's the implementation of knowledge that brings power" - Andres Galindo.
|
|
|
|
04-27-2008, 09:41 PM
|
#9 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by TlcAndres
No, I meant the query to check if the ID has already been used.
|
But everyone can login on same user id.. ? :O
__________________
|
|
|
|
04-28-2008, 05:08 AM
|
#10 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
|
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.
__________________
no signature set
|
|
|
|
04-28-2008, 09:33 AM
|
#11 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by sarmenhb
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.
|
But still, it's just one single user account in the database.
I want to record how many people are online on THAT SAME ACCOUNT at the SAME TIME.
__________________
|
|
|
|
04-28-2008, 11:23 AM
|
#12 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
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?
|
|
|
|
04-28-2008, 03:28 PM
|
#13 (permalink)
|
|
The Wanderer
Join Date: Apr 2008
Location: Trapped in my own little world.
Posts: 14
Thanks: 0
|
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
|
|
|
|
04-29-2008, 07:30 AM
|
#14 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
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  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..
__________________
|
|
|
|
04-29-2008, 02:50 PM
|
#15 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
I could just see your login page
Username:
Password:
Real Name (Yes, we know its not the maker):
|
|
|
|
04-29-2008, 03:17 PM
|
#16 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Excuse me?  What? xD
__________________
|
|
|
|
04-29-2008, 04:32 PM
|
#17 (permalink)
|
|
The Contributor
Join Date: Dec 2007
Posts: 60
Thanks: 5
|
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
|
|
|
|
04-30-2008, 08:57 PM
|
#18 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by Jay
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
|
Well, I don't want anyone who visits the site to be able to see everything. That's why everyone in the society gets the account name and password so they can log in and view the site.
And I want to be able to record how many of them are online on that account at the same time :P
__________________
|
|
|
|
04-30-2008, 11:22 PM
|
#19 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
Use .htpasswd to protect the site, and record ip/user agent combinations to determine who's online.
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|