Welcome Guest, Not a member yet? Register   Sign In
prevent multiple login Codeigniter 4
#1

hii all, btw i want to make login system, and check if user is multiple login and give notification " account already login in other device" in current user login, how can i make it ?? can someone please suggest/teach me to make system like that? Previously I've searched for it on google but couldn't find the right one,, please help for my learning
Reply
#2

(This post was last modified: 04-02-2022, 03:26 PM by seunex.)

Simple logic store a token everytime the user login to the database and store d copy of the token to the active session. In case he login in somewhere else the token will be overwritten and if mis matches log of the user.

It a simple trick.
Reply
#3

Thanks
Reply
#4

I would say it is even simpler than that. As soon as you log in it sets a flag is_logged_in to true, and if you try again from wherever it checks against this flag before allowing you to go any further, i.e setting session data etc.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Reply
#5

(04-02-2022, 11:02 PM)ignitedcms Wrote: As soon as you log in it sets a flag is_logged_in to true,

I don't get the implementation.
Where do we set a flag is_logged_in?
Reply
#6

@kenjis , I think he ment set a session flag is_logged_in when the user logins into the system.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB