Welcome Guest, Not a member yet? Register   Sign In
no segment, how redirect 404 ?
#4

Be sure to properly validate your input! Although you process a _GET variable which should be validated by the permitted_ui_chars in your config but if by some fuck-up gets changed to allow all chars you are in trouble.

In this case I would simply type cast the $value to an integer. Or use query bindings to escape the value in your query like in the example below.

Also if you are just interested in knowing if a record with some field value exists, dont't use "select *", but "select 1".

PHP Code:
public function check_value($value)
 
   {
 
       $sql    "SELECT 1 FROM table_name WHERE field = ? ";
 
       $query  $this->db->query($sql, array($value) );

 
       $result $query->result_array();

 
       if (empty($result)) {
 
           return false;
 
       }

 
       return true;

 
   
Reply


Messages In This Thread
no segment, how redirect 404 ? - by stat - 02-02-2016, 07:02 AM
RE: no segment, how redirect 404 ? - by stat - 02-03-2016, 12:17 AM
RE: no segment, how redirect 404 ? - by Diederik - 02-03-2016, 07:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB