开发者

Restrict access to certain users

开发者 https://www.devze.com 2023-03-01 20:00 出处:网络
I want to setup certain password protected pages but want the pages accessible only to certain users. Do I need to pre-assign usernames and passwords, 开发者_StackOverflow社区or is there a way to set

I want to setup certain password protected pages but want the pages accessible only to certain users. Do I need to pre-assign usernames and passwords, 开发者_StackOverflow社区or is there a way to set up my database so it will detect those users I want to authorize and grant access to?


For such situations, you could use different privileges for users. Set a corresponding session variable to indicate current users privilege level. And of course, you would need to have that information regarding privileges in database.


You can store the usernames and passwords in the database, and then check the access rights to the protected pages.


I think the best solution for my situation was to add to the query AND userlevel='1' and set the db to a default of 0 and change authorized users to 1.

0

精彩评论

暂无评论...
验证码 换一张
取 消