jeudi 8 novembre 2018

How do I check for permissions in a session?

I made a login page, which works fine. Every account on my system has a username, password and permission. On the login screen you only have to fill in your username and password, and the record gets automatically linked to the session, so Im sure the session knows what permission it has when logged in. I want to make a difference between a admin and a user account. An admin account should be redirected to a different screen as the user. This is my code:

if ($_SESSION['Permission'] = "admin") { 
    header("location:adminmenu.html");
    } else
    header("location:usermenu.html"); 

When I run this, it automatically takes me to the admin menu, even if the statement isnt correct. How can I fix this?

Aucun commentaire:

Enregistrer un commentaire