ci_session with multiple database not working - 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: ci_session with multiple database not working (/showthread.php?tid=73515) |
ci_session with multiple database not working - samtron - 05-02-2019 I am working on a project where using two databases. My requirement is that, Depending on user login type load database e.g. For user type 1 load db1(default database) Or For user type 2 load db2. Problem is that if login with user type 1 then logged in successfully but if login with user type 2 then login failed due to the ci_session table. how to fix this issue. RE: ci_session with multiple database not working - php_rocs - 05-02-2019 @samtron, Why don't you initiate the session after the user is verified? If the login fails then simply send an error message and don't start the session. RE: ci_session with multiple database not working - samtron - 05-02-2019 (05-02-2019, 06:53 PM)php_rocs Wrote: @samtron, You means don't use autoload session? RE: ci_session with multiple database not working - php_rocs - 05-03-2019 @samtron, Correct. You can wait to initialize a session after the user has successfully logged into the application. RE: ci_session with multiple database not working - dave friend - 05-03-2019 (05-02-2019, 06:53 PM)php_rocs Wrote: Why don't you initiate the session after the user is verified? If the login fails then simply send an error message and don't start the session. Because the session is used to identify someone who has successfully logged in but has been redirected to, or has navigated to some other page. RE: ci_session with multiple database not working - samtron - 05-03-2019 (05-03-2019, 05:28 AM)php_rocs Wrote: @samtron, Ok, Thankyou RE: ci_session with multiple database not working - dave friend - 05-03-2019 (05-02-2019, 01:17 PM)samtron Wrote: Problem is that if login with user type 1 then logged in successfully but if login with user type 2 then login failed due to the ci_session table. how to fix this issue. The fix is to not use PHP Code: $config['sess_driver'] = 'database'; Any other driver will work. RE: ci_session with multiple database not working - samtron - 05-03-2019 (05-03-2019, 08:01 AM)dave friend Wrote:(05-02-2019, 01:17 PM)samtron Wrote: Problem is that if login with user type 1 then logged in successfully but if login with user type 2 then login failed due to the ci_session table. how to fix this issue. Any example? RE: ci_session with multiple database not working - dave friend - 05-03-2019 (05-03-2019, 08:51 AM)samtron Wrote: Any example? 'files', ‘memcached’, or , 'redis' I usually use 'files'. It's easy to implement and proven to be responsive even on sites with daily session hits in the hundreds of thousands. If you need to handle millions of sessions a day then you want a memcached setup - and a better system admin than me. |