Home >php教程 >php手册 >有漏洞无作为才可怕、可耻!,漏洞作为

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

WBOY
WBOYOriginal
2016-06-13 08:49:391060browse

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

  安全问题:

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

  例如:

    

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

    }</span>

 

  

   
Statement:
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