?
Solved

How can I restrict one login per user...

Posted on 2001-08-02
18
Medium Priority
?
525 Views
Last Modified: 2013-12-24
Let's say that user#1 wants to login using 'login' and 'password'.

The way that I have my login script working is that as many people can login at the same time using the same login name and password.

How do I restrict that to one login per session?
0
Comment
Question by:webmaster256
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
  • +4
18 Comments
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 6345753
If you add a column to your table called "Is_Logged_In", then you can enter a positive boolean value in "Is_Logged_In" column when the user logs in. then if he or someone else tries to log in using the same userid\password you will know if the userid/password is being used.
The tricky part about this is that the user must also log out to set the "Is_Logged_In" value back to a negative boolean value. And as we know, people don't always do what they are supposed to and if they didn't log out then they can't log back in because the database thinks they are still logged in.
Therefore you must also add another column named "Login_Date_Time", in this colum you enter the date\time that the user logged in. then you have a stored procedure that runs as often as you like to check how long people have been logged in. Choose a length of time that you know is too long for the person to be logged in. For this example situation we will say that the average session time for users on your site is half an hour. you can then set your stored procedure to find all the records with a positive boolean log in value that have been logged in for 2 hrs and update the "Is_Logged_In" column to a negative boolean value.

Does that make sense?

There are probably other ways to do it as well, but this is the first I could think of.

-Scott
0
 

Author Comment

by:webmaster256
ID: 6346349
0
 

Author Comment

by:webmaster256
ID: 6346352
What happened? I typed in a whole bunch of text, and it did not display!!!
0
Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

 

Author Comment

by:webmaster256
ID: 6346356
0
 

Author Comment

by:webmaster256
ID: 6346365
Well, it does not want to display my code...

So how the heck am I supposed to get some help here when people cannot see my code?


Gordon
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 6346379
sometimes EE is wierd like that. I've had trouble posting code in that past and usuall i can get around it by adding some more text to the beginning like an intro comment. or just reformatting the carriage returns and stuff.
0
 

Author Comment

by:webmaster256
ID: 6346384
Well, it does not want to display my code...

So how the heck am I supposed to get some help here when people cannot see my code?


Gordon
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 6346484
try posting now.. I think EE just fixed its problems.

CJ
0
 

Expert Comment

by:MikeForbes
ID: 6347084
If yo want to restrict a user from logging in more than once, I would start with making sure you are setting up a Session variable that carries the user name with them upon successfull login.  Then I would add code in your login script to also check if the login(user name) EQ the Session login name.  If it does, display a message that the username/combo is being used and/or re-route them back to the login screen.

I wouldn't necessarily go the database route, because you have much un-nucessary server calls and overhead.

Give it a try,

Mike
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 6347097
Mike,

The object of the question at hand is to stop multiple people (Potentialy on different computers) from logging in under the same username/password at the same time.
I don't see how this can be done by simply checking against the session scope.
0
 
LVL 6

Expert Comment

by:dash420
ID: 6348492
Simple solution is added one fields in the your user validation table , some thing like is_login.


is_login char(1) default 'N'

while user login in get the user logs, so just run a query while submiting the form

something like

<cfquery name="qry_islogin" datasource="dsn">
  select is_login
  from your table
  where key(assume user_id) = '#cgi.remote_user#'
</cfquery>

<cfset login = #qry_islogin.is_login#>

<cfif login is "N">
    url.location "suceess fully login"
    called some template (run the query) that will
    update this user_id in ur table as "Y"
<cfelse>
    Gives soory message
</cfif>

while logout make taht fellow "N" again


 




0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 6349606
Dash,

That is the same suggestion i gave.

-Scott
0
 
LVL 5

Expert Comment

by:Yog
ID: 6359112
this way , you see i can register twice, have 2 ids and login twice lol...

you got to think of force using cookies only
0
 
LVL 6

Expert Comment

by:dash420
ID: 6359156
But I my mind in an organisation no user have more than one user id.

:-)
0
 
LVL 5

Expert Comment

by:Yog
ID: 6359239
true. what you said makes sense. what kinda site is it?
0
 

Author Comment

by:webmaster256
ID: 6364174
The site is going to be for online video viewing... All types; G, PG13, R, NC17, and XXX.

There is also a rating system in place which is about 2/3 done...

Here is the link...

http://coldfusion.dreamstudio9.com/dreamstudio9/login.cfm


Check it out... I'll soon have the code in a .txt page for all oyou to view and give your comments on... :)

Gordon


0
 
LVL 1

Accepted Solution

by:
_X_ earned 400 total points
ID: 6378607
0
 

Author Comment

by:webmaster256
ID: 6384491
Thanks X! I had been looking all over the place for something like that!

Gordon
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
What You Need to Know when Searching for a Webhost Provider
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question