i have back/front end login sistems.
But using codeigniter session seems to use the same session id for both. So if i destroy the session for the backend when signing out, the session is destroyed on the front end as well. If i only unset() the userdata, the session id remains and the next admin logged in, useses the same session wich is not good. Apparently CI autogenerate Sessions IDs. Can i do that manualy?
Any suggestions? Please help, i've bean checking the net for hours and i can't find a sollution.
Are you using different Codeigniter installs for frontend and backend? If so, you can set different sess_cookie_name values in your app config.php file.
Take a look here: https://www.codeigniter.com/user_guide/libraries/sessions.html#session-preferences
You can use Codeigneter session library to handle this. If the user logs in admin, you can create (and check) a variable in session like, ie:
$this->session->userdata('is_admin',TRUE);
And store the data in a specific object in session only in backend. When logout only delete this session data, and then, the user still be logged in frontend.
Check: https://ellislab.com/codeigniter/user-guide/libraries/sessions.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.