-2

how to show options according to user permission in PHP? For example, that only administrators enter to "xx" menu.

This is my table

Permissions_users

Table Permissions_users

And this is my table

users

Table Users

  • When user login, try adding privilege into session then check it by `if($_SESSION['priviledge'] == 'teacher'){ //do this } ` – Aniket Singh May 06 '17 at 06:19
  • You use [sessions](http://php.net/manual/en/ref.session.php) to allow different user roles. – Rasclatt May 06 '17 at 06:19
  • Now I have if ($ _ SESSION ['privilege'] == 'teacher'), but what do I do if I create a new user with any name(for example, teacher2) with only read permissions, or read and delete, or just delete? How do I control what he can see according to his permits? – George Hermsilla May 06 '17 at 06:33

1 Answers1

0

alter user table add one column:is_admin(0/1).according to this value to show or hide options.

Gurwinder Singh
  • 38,557
  • 6
  • 51
  • 76
roiyu
  • 11
  • 4