I Used libraries Encrypt on Codeigniter 2.2.6 but when i change in CodeIgniter 3.1.10 , for php 7.2, i need to use Encryption and i can't use encrypt. When i want do login , the page refresh itself.. why ? What is wrong?
Function login() {
$this->obj->load->library('encryption');
$username = $this->obj->input->post('username');
$password = $this->obj->input->post('password');
$query = $this->obj->db->get('userd');
$login_result = FALSE;
foreach($query->result() as $row) {
if($row->access== 1 && $row->username == $username && $this->obj->encryption->decrypt("$row->password") == $password) {
$login_result = TRUE;
$user_id = $row->id;
$user_name = $row->cognome." ".$row->nome;
}
}
if ($login_result) {
$credentials = array('user_id' => $user_id, 'logged_in' => $login_result);
$this->obj->db->set("ip",$this->obj->input->ip_address());
$this->obj->db->where("id",$user_id);
$this->obj->db->update("userd");
$this->obj->session->set_userdata($credentials);
}
return $login_result;
}