I am trying to create a session for user and another for admin based on a variable which gets the status (from database) of the username. I have managed to create a session for user but it doesn't seem to work for admin. I get an error Undefined index: user, when I try to login as admin and I dont know whats causing the problem.
How do I create a different session for admin?
This is the code written in the controller:
$user = new Login($this->db);
$user->getByName($username);
if ($s['status'] == 'user'){
$this->f3->set('SESSION.user', $user->username);
$this->f3->reroute('/');
}
if ($s['status'] == 'admin'){
$this->f3->set('SESSION.admin', $user->username);
$this->f3->reroute('/');
}