安全问题:
是否有权限进行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>