Preventing simultaneous login

Results 1 to 8 of 8

Thread: Preventing simultaneous login

  1. #1
    Yoon Cho Guest

    Default Preventing simultaneous login

    I&#039m trying to set up a membership section where only paying members can view the contents. I want to know if there is a way to prevent somebody else (perhaps a friend), who knows the login ID and password, from accessing the restricted pages at the same time. I would assume that you probably can&#039t prevent them from sharing login info.

  2. #2
    Steve Cimino Guest

    Default RE: Preventing simultaneous login

    Nope. If you give your car keys to someone else, they can use your car.<BR><BR>You can&#039t check IPs, since many providers have dynamic IPs.

  3. #3
    Steve Cimino Guest

    Default Wait a minute...

    It&#039s Monday. I should&#039ve read your title more closely. You can prevent simultaneous logins. You can store the login ID to a temporary database table. If it exists in there, then redirect the simultaneous user to a message that says "Already logged in". Once the original user&#039s session expires, delete the record from the temporary table. That way he can log in next time.

  4. #4
    Yoon Cho Guest

    Default RE: Wait a minute...

    Thanks Steve! I&#039ll give it a try.

  5. #5
    Yoon Cho Guest

    Default RE: Wait a minute... - more question

    One more thing.<BR>How would you do this?<BR>Do I have to excute a stored procedure to execute the delete? <BR>

  6. #6
    Steve Cimino Guest

    Default RE: Wait a minute... - more question

    Sure, use a sproc.<BR><BR>The user enters into your site. You verify he is who he is. Then stick him into a temp table:<BR><BR>INSERT into TableName VALUES(loginID)<BR><BR>Check to see if he&#039s already on:<BR>SELECT loginID FROM TableName<BR><BR>The user leaves:<BR>DELETE FROM TableName WHERE loginID = whatever<BR><BR>

  7. #7
    Yoon Cho Guest

    Default RE: Wait a minute... - more question

    What about for those times when the user doesn&#039t log out, but rather just closes the browser? How do I execute the stored procedure then?

  8. #8
    Olivier Guest

    Default RE: Wait a minute... - more question

    In the global.asa file, there should be a subroutine called session_onend. That subroutine will be executed when his session ends (either time out either he closes his browser). Put your delete logic in there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts