Welcome Guest, Not a member yet? Register   Sign In
Single User Access
#1
Information 
(This post was last modified: 07-03-2015, 10:30 AM by JoelPiccoli.)

Hello everyone! Everything allright?

I have a little big problem in my hands and I come here to ask you guys for help.  Huh

I develop a system for a client couple weeks ago. Yesterday he came with an ideia to implement the single user access, what means that a user can't be logged in two places at the same time.

I was wonderer if it could be implemented with the ci_sessions table in the database and if anyone here have already done something like this.


Thanks everyone!  Wink


PS: I forgot to tell that in this project I'm using CI 2 Wink
Reply
#2

Yes, and this is a feature of Community Auth. If you have a user and want to only allow one login, then when he/she logs in you store the session ID in that user's record. Every page load you see if the session ID matches the session ID in the user's record. If the session ID is updated in the session class, you update the session ID in the user's record. It's really pretty simple.
Reply
#3

(07-03-2015, 10:18 AM)skunkbad Wrote: Yes, and this is a feature of Community Auth. If you have a user and want to only allow one login, then when he/she logs in you store the session ID in that user's record. Every page load you see if the session ID matches the session ID in the user's record. If the session ID is updated in the session class, you update the session ID in the user's record. It's really pretty simple.

Let me see if I understood, So, If I implement this my user will be unable to log with the same user in diferent places... Am I correct?
Reply
#4

Yes. Only one login per user, because there is only one session ID stored in the user's account, and it has to match for the user to be logged in. If the user logs in from a second device or location, then it will "kick off" the other session.
Reply
#5

you can filter ip adresses and host device. don't forget to add a timeout in order to delete persistent connexion from one device...
NexoPOS 2.6.2 available on CodeCanyon.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB