0

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;
    }
Phantom Moore
  • 41
  • 1
  • 8
  • Possible duplicate of [mcrypt is deprecated, what is the alternative?](https://stackoverflow.com/questions/41272257/mcrypt-is-deprecated-what-is-the-alternative) – miken32 Mar 08 '19 at 18:06
  • 1
    please read: https://codeigniter.com/userguide3/libraries/encryption.html and consider using something like CI-ion-auth for login https://github.com/benedmunds/CodeIgniter-Ion-Auth – Vickel Mar 08 '19 at 18:56

0 Answers0