有破绽无作为才可怕、可耻

WBOY
Release: 2016-06-13 12:27:53
Original
914 people have browsed it

有漏洞无作为才可怕、可耻!

  安全问题:

  是否有权限进行CURD,因为参数在地址栏里,是可以修改的,(或参数在html页面里,可以用firebug修改源码),所以进行CURD之前要先查询该操作人是否拥有这条记录,比如:根据门店ID和传递的参数查询这条记录是否属于这个操作人,如果不属于就提示(非法操作,已被记录!,以达到警告的目的)

  例如:

    

    <span style="color: #008000;">/*</span><span style="color: #008000;">     * 校验是否有权限进行CURD     </span><span style="color: #008000;">*/</span>    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">function</span> check_rbac(<span style="color: #800080;">$theme_id</span><span style="color: #000000;">){        </span><span style="color: #800080;">$model</span>=<span style="color: #000000;">M();        </span><span style="color: #800080;">$adm_session</span> = es_session::get(<span style="color: #008080;">md5</span>(conf("BI_AUTH_KEY")), 1<span style="color: #000000;">);        </span><span style="color: #800080;">$location_id</span>=<span style="color: #800080;">$adm_session</span>['supplier_locations'<span style="color: #000000;">];        </span><span style="color: #800080;">$map</span>=<span style="color: #0000ff;">array</span>('id'=><span style="color: #800080;">$theme_id</span>,'location_id'=><span style="color: #800080;">$location_id</span><span style="color: #000000;">);        </span><span style="color: #800080;">$result</span>=<span style="color: #800080;">$model</span>->where(<span style="color: #800080;">$map</span>)->getField('id'<span style="color: #000000;">);        </span><span style="color: #0000ff;">if</span>(<span style="color: #0000ff;">empty</span>(<span style="color: #800080;">$result</span><span style="color: #000000;">)){            </span><span style="color: #800080;">$this</span>->error('非法操作,已被记录!'<span style="color: #000000;">);        }    }</span>
Copy after login

 

  

 
 
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template