Welcome Guest, Not a member yet? Register   Sign In
is_unique for encrypted data
#5

You will need to add your own is_unique validation method. This method needs changing anyway as it only works on records that you are inserting. When updating a record it will fail because the method does not check if the posted update matches the found record.

As for the encrypted data. Create your own is_unique method and just encrypt the value before using it in your query

PHP Code:
public function is_unique($str$field)
{
 
   $this->CI->load->library('encryption');
 
   $encrypted_str $this->CI->encryption->encrypt($str);

 
   sscanf($field'%[^.].%[^.]'$table$field);
 
   return isset($this->CI->db)
 
       ? ($this->CI->db->limit(1)->get_where($table, array($field => $encrypted_str))->num_rows() === 0) : FALSE;

Reply


Messages In This Thread
is_unique for encrypted data - by pb.sajjad - 03-13-2017, 03:58 PM
RE: is_unique for encrypted data - by neodite - 03-15-2017, 12:34 AM
RE: is_unique for encrypted data - by pb.sajjad - 03-15-2017, 07:02 AM
RE: is_unique for encrypted data - by Martin7483 - 03-29-2017, 03:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB