有漏洞无作为才可怕、可耻!
安全问题:
是否有权限进行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>