Is it correct to store this value in session array?
Set out to develop one system where there is access rights.
There is a controller Controller, recourse to all the methods which are permissible only to the administrator. The admin role has ID = 1.
When a user logs in $_SESSION['user_role'] is written ID his role.
In one of the controllers doing the test — if ID = 1 (Admin) to allow calling the methods of a controller Controllerif ID != 1 (Normal user), then to forbid calls of these methods.
Correctly in technical terms, to do the test this way? Is it safe to check?
asked July 9th 19 at 11:25
Find more questions by tags MySQLPHPWeb Development