1
votes

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.

2

2 Answers

0
votes

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

0
votes

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, i.e:

$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