Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Prevent that 2 people login with same account
Old 11-11-2004, 11:03 AM Prevent that 2 people login with same account
Junior Talker

Posts: 4
Trades: 0
Hi!

I want to prevent that 2 different people using the same user/pass to login to the website at the same time.
Do i need application-variables, or is there an other way to check this?
If i need application-varibles, it would be very nice if u can explain me how to use them, becuse i never used them before.
Thank ya very much,
greets ben
Benyn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-12-2004, 01:13 PM
sdcdesign.co.uk's Avatar
Extreme Talker

Posts: 198
Location: High Wycombe, Buckinghamshire, London
Trades: 0
Benyn,

It would be nice if we knew what programming language you were using...
__________________
[ Insert witty, yet highly intelligent signature here ]
sdcdesign.co.uk is offline
Reply With Quote
View Public Profile Visit sdcdesign.co.uk's homepage!
 
Old 11-12-2004, 01:23 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Well, considering this is the ASP section of the forum, thats probably a good start.

I would look into Sessions. Once a user has a session active you can then just check the username that a person enters in the form against all active sessions and if it exists, then do whatever you like, namely not letting them log in again.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 11-15-2004, 04:21 AM
Junior Talker

Posts: 4
Trades: 0
Quote:
Originally Posted by sdcdesign.co.uk
Benyn,

It would be nice if we knew what programming language you were using...
I'm using VBScript


Quote:

Well, considering this is the ASP section of the forum, thats probably a good start.

I would look into Sessions. Once a user has a session active you can then just check the username that a person enters in the form against all active sessions and if it exists, then do whatever you like, namely not letting them log in again.

Sessions are only avaiable on the machine on which they were createt...
So how could I check on computer B the sessions which are created computer A ?
I mean, when the user "jimmy" log on on comp A, session("jimmy") = "logged in", then on comp B the session("jimmy") is empty, because it wasnt created there.
Know what I mean, or have i got you wrong?
Benyn is offline
Reply With Quote
View Public Profile
 
Old 11-15-2004, 09:55 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Save session state in a cookie
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 11-15-2004, 12:45 PM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Quote:
Save session state in a cookie
That won't stop 2 people logging on at the same time.

I've never used them before, but I think your best bet would be Application variables. They work nearly the same as session variables

Application("MyVar") = "MyVal"

You'll probably want to create an Array to store a list of logged on usernames. When somebody loggs on, it checks to see if their name is already in the list or not, if it's not, it adds it. (Don't forget to remove it on logout, and remember some people don't explicitly log out, they just close the browser window, in which case do it from the Session_OnEnd event in Global.asa)
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 11-15-2004, 07:54 PM
vivekar's Avatar
Webmaster Talker

Posts: 612
Trades: 0
Application vars are expensive. Carefully use them.

If your website has more and more users, the application vars would grow larger with your requirement.
There will be some performance hit.
Sometimes, even session vars are also not reliable in Classic ASP ( VBS).

Instead use a db table to store the most active users and flush/refresh it for say at 20 minutes interval.
Check the login table and active users table for each login initiation.
__________________

Please login or register to view this content. Registration is FREE
(Active since 2003) |
Please login or register to view this content. Registration is FREE
vivekar is offline
Reply With Quote
View Public Profile Visit vivekar's homepage!
 
Old 11-16-2004, 11:09 AM
ACW
Average Talker

Posts: 26
Trades: 0
I agree with vivekar and I use a similar approach.

When a person logs in I create my own SessionID and store that in a database table with the UserID and a LastActivity time stamp. I then set the SessionID on the browser as a cookie. All secure pages look for that SessionID on the database table if it exists then all is well. If it doesn't exist it asks them to log in.

Now, if a person logs in using the same UserID as an active user, it will assign that UserID a new SessionID effectively "kicking out" the original active user. There are a few other things involved, like code to delete sessions that have expired.

I've used this in more systems than I can count and so far it has worked great. I suggest you encapsulate all this functionality in a class so that you can easily include it in various projects.
__________________

Please login or register to view this content. Registration is FREE
by Geo Redundant Hosting
ACW is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Prevent that 2 people login with same account
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.54803 seconds with 12 queries