开发者

PHP user permissions - best practice?

What is the best practice to manage user permissions with PHP/MySQL?

What I have currently is a column in the users table that is called 'permissions', with a string that is comp开发者_运维百科ared for certain pages.

if($_SESSION['permissions'] == 'Administrator' || $_SESSION['permissions'] == 'Moderator'){
// do stuff
}

I'm sure there is a better way to get this accomplished in a simpler, easier way. Any recommendations?


How exactly are you managing 'mySql' permissions? Do you mean your controlling actions in your website that are capable of performing database actions, or you're literally needing database access rights management?

If its via the web, you could incorporate something like Zend Framework's ACL if you're looking to get that in depth, or any other existing permissions system built in PHP.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜