Home >Backend Development >PHP Tutorial >PHP prevents SQL injection by filtering paging parameters_PHP tutorial
We have heard this saying, don’t trust any input information on the Internet, we all must filter parameters. Now I will introduce filtering paging parameters, friends in need can refer to it.
Example
The code is as follows
|
Copy code
|
||||
$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'] = 'First page'; $config ['last_link'] = 'Last page'; $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'] = 'Page'.$current_page.'-Guestbook-Website of the First Hongzhi Class of Daye Experimental High School'; } else{ $data ['title'] = 'Guestbook-Website of the First Hongzhi Class of Daye Experimental High School'; } $data ['liuyan'] = $this->ly->getLy ( $pernum, $currentnum );
|
The code is as follows
|
Copy code |