Breaking login flow if already logged in with another session Codeigniter 3 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Breaking login flow if already logged in with another session Codeigniter 3 (/showthread.php?tid=76787) |
Breaking login flow if already logged in with another session Codeigniter 3 - ThumbPacked - 06-20-2020 I am working on a codeigniter 3 app and ive recently implemented a session checker that deletes a user session if they're already logged in. Now we want a modal box to pop up if the user is already logged in with another session. I am able to get a modal box to pop up using a button but i want to implement it into the original flow of the login system. As it is the login form takes you straight to the validate login system. This is the login form now: Code: <form action="<?php echo site_url('login/validate_login/user'); ?>" method="post"> The button at the moment goes straight to this login function: PHP Code: public function validate_login($from = "") { I created this function to pull the user id from an email: PHP Code: ublic function get_user_id($user_email = "") { Then I use this function to check if there is a session and return [i]false[/i] if there are 0 results and [i]true[/i] if there is a session with that user id. So if its false they should be able to log in and the modal pop-up shouldn't open but if its true it should open. PHP Code: public function user_has_session($user_id=''){ Thanks
Here is the previous problem I had which I have answered myself on stack overflow. It's related because this post shows my logic for the login sessions:codeigniter 3 stop multiple logins using ci_sessions database Thanks and regards Zayd Bhyat |