ahm*_*l88 0 php forms security post
我有一个PHP表单页面(page.php),有3种不同的模式(插入/编辑/查看)
索引页面(index.php)包含3个导航到(page.php)的链接,每个链接将根据当前用户角色显示
index.php
<html>
<body>
<div id='main'>
<a href="page.php?insertMode=true&editMode=true">Insert Student Screen</a> <br>
<a href="page.php?insertMode=false&editMode=true">Edit Student Screen</a> <br>
<a href="page.php?insertMode=false&editMode=false">View Student Screen</a> <br>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我的问题
既没有insertMode也没有editMode(insertMode=false&editMode=false
)的用户
可能会更改URL中的值然后
他会page.php
在一个他没有角色的模式下打开它
此权限必须存储在数据库中...不在URL中.因此,当您在会话中加载用户时,您也加载了他的权限,并且可以轻松检查他是否有权编辑或插入.
最好的方法是拥有一个表User,一个表Right(包含所有可用权限)和一个关联这些表的表(如UserRights?),其中主键由User和Right的主键组成.然后,用户可以拥有多个权限.
你应该看看这个.
http://www.singingeels.com/Articles/Understanding_SQL_Many_to_Many_Relationships.aspx
归档时间: |
|
查看次数: |
47 次 |
最近记录: |