时间:2022-12-06 01:26
分页参数防止SQL注入的方法:
对任何输入信息都必须进行参数过滤,php实例:
$this->load->library ( 'pagination' );
$config ['base_url'] = site_url () . '/guest/show';
$config ['total_rows'] = $c;
$config ['per_page'] = $pernum = 15;
$config ['uri_segment'] = 3;
$config ['use_page_numbers'] = TRUE;
$config ['first_link'] = '第一页';
$config ['last_link'] = '最后一页';
$config ['num_links'] = 5;
$this->pagination->initialize ( $config );
if (! $this->uri->segment ( 3 )) {
$currentnum = 0;
} else {
$currentnum = is_numeric($this->uri->segment ( 3 ))?(intval($this->uri->segment ( 3 ) - 1)) * $pernum:0;
}
$current_page=is_numeric($this->uri->segment ( 3 ))?intval($this->uri->segment ( 3 )):1;
if($current_page){
$data ['title'] = '第'.$current_page.'页-留言本-防SQL注入测试';
}
else{
$data ['title'] = '留言本-防SQL注入测试';
}
$data ['liuyan'] = $this->ly->getLy ( $pernum, $currentnum );
其中以下这两句判断了参数是否为数字,防止非法字符输入。
$current_page=is_numeric($this->uri->segment ( 3 ))?intval($this->uri->segment ( 3 )):1;
$currentnum = is_numeric($this->uri->segment ( 3 ))?(intval($this->uri->segment ( 3 ) - 1)) * $pernum;
最强NBA3月28日每日一题答案分享_与莫宁一起登场的防守钻石球星是哪一位(图文)
2023-01-08首先我长这衰样表情包_首先我长这衰样图片大全(图文)
2023-01-08成语小秀才第1081-1090关答案_成语小秀才攻略(图文)
2023-01-08dnf3月28日每日一题答案分享_DNF公会副本永恒殿堂需要净化到多少才出会特殊商人(图文)
2023-01-08成语小秀才第1091-1100关答案_成语小秀才攻略(图文)
2023-01-08完美世界手游3月28日每日一题答案分享_一次曲别针换别墅任务需要跑多少环(图文)
2023-01-08我丘比特今天就不信了表情包_丘比特射箭表情包(图文)
2023-01-08愚人节不要骗我的图片_谁要是敢在愚人节骗我表情包(图文)
2023-01-08