Welcome Guest, Not a member yet? Register   Sign In
prevents login with same username at the same time
#1

[eluser]dpsamarasekara[/eluser]
hi,

i'm doing a site and i need to prevents login with same username at the same time.but there are several other modules bind to main system and they have own codeigniter installations. but loggin is centralized.so same user can't log in two places using his username. if so i need to give msg "username is in use" .

how can i do this.
#2

[eluser]toolwieldingape[/eluser]
You could add the user_id to the session table and kick out the old session if one exists.

should work.
#3

[eluser]WanWizard[/eluser]
That's basically how I have implemented it.

In my case the user_id is part of the session data, so I use a regex to check if a session record for that user exists.
#4

[eluser]dpsamarasekara[/eluser]
hi thank you for both of you. is session table automatically delete a recode once one have left or do i need to do it manually. i means if the use left the browser with out logging of or if he had a power cut. then session table keeps the recode and user can't log in again. i don't know how the process going, but if so it'll be a problem.

what do you think?

thank you.

Dinesh
#5

[eluser]shower[/eluser]
to avoid such conditions you can do

1.add the users to the dictinary in session start( of course you need to check whether the user already exists or not)


2.if the users exist do allow to proceed

3.Remove the users from the section once the user logouts out

4. create a dictionary in application start event
#6

[eluser]dpsamarasekara[/eluser]
hi,

thank you for replying but i didn't get what did you mean by "dictionary".

and it's not clear me the procedure as well.is that a another table? i can't understand that.please say it again with more details.

thank you very much for guiding me.




Theme © iAndrew 2016 - Forum software by © MyBB