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.
精彩评论