How to make a page accessible only to users at a certain level

Asked

Viewed 65 times

0

Good morning, I have a login system with php and mysql, in the database I have 2 users, one has Admin level (0) and the other Master (1), I have the login page that asks the person’s Username and Password and checks if the entered data matches the BD, after logging in correctly, the page redirects the user to a system admins page, on this page there is a side menu where there are several buttons, each redirecting to a page, such as the Post page and the Changes page. Here is my problem: the users page, this page should only be accessed by users whose level is Master (or 1), but I do not know how to do it, I tried to use of Sesssions and query, but always ends up giving in error or letting pass any user instead of barring those who are Admin (or 0).

  • Any questions you have regarding a one-touch response

1 answer

1


Man I believe a lot in the reuse of code and projects, for this reason I believe you could go on the site https://aspnetboilerplate.com/ and create a project with a ready-to-go template instead of 0, in this template you find all your needs and can configure new ones according to what is needed, in it you have Tenents (which would be environments) and within the environments you can configure users with levels (already has a good level base ai you adapt to your needs)

Project view page "running" https://gurayyarar.github.io/AdminBSBMaterialDesign

Github page: https://github.com/gurayyarar/AdminBSBMaterialDesign

Page to create template: https://aspnetboilerplate.com/Templates

Browser other questions tagged

You are not signed in. Login or sign up in order to post.