I am trying to stop users from sharing there login info so that if user1 logs in and is using my application and user2 tries to login with the same login in info it would either log both out or log user1 out. Has anyone done this before with Yii?
That’s actually a very good idea for an application I am currently working on… I’ll let you know what I come up with (gonna sleep on it… always seems to work for me).
I have done it in one of my normal php application but I think its not the best way. WHat I have done: When user login then you can change his status as logged or something else. When he logout you can change the status to logouted or something you preferred. If user status is logeed then if anyone try to log then you restrict to login. Now what happen if user not logout just close the browser window? you can make a time difference like after 3 hours from his login he will count as logout.
To me its not a good idea and there must be some others way to handle it. Like session saved on database. But I don’t use that way so I can’t tell.
Maybe have a little AJAX script updating a value in the DB with the current time every 5 minutes. If the browser window is closed the script stops and the person is considered logged out.
One idea is that you log one user out, before logging another user in. This way, if he refreshes the page, or goes to another site, he will be logged out.
Another idea is to use a combination of AJAX/Comet to kick a logged user out or keep a logged user in, and the newly logged user out.