How can i Restrict same username and password in different systems login

Finsol123
Finsol123 used Ask the Experts™
on
Hi,
     i have an application with username and password login based using java. i want to restrict same username and password login in different systems at a time. could you give me explain with example.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
When you say "restrict" what do you mean?   Are you saying that you want the user to be able to login only to one system and then not the other?  That is, any username can only be logged in once between the two systems?

Assuming that is right, if the two systems share the same database, this is not hard.

Add a field to the user table with a session ID.  When the user logs in, set their session ID on their record.  Each page request verify their session ID matches their session, if it does not, log them out and tell them someone has logged in again under their account.

When the second person logs in under the same username, replace the session ID with their session identifier, this will log out the first person
You should never give a "B" grade without first following up and asking for more information; if needed.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial