Password encrypt and match in CI4 with hash encrypt
Encrypt:
1 | $pwd = password_hash($this->request->getPost('pwd'), PASSWORD_BCRYPT); |
Match:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | $user = $this->db->table('customer') ->select('id, first_name, last_name, uname, emailid, contact, picture, pwd') // Email aur password select karo ->where('emailid', $email) ->get() ->getRow(); if ($user && password_verify($password, $user->pwd)) { $record = $user; // Password matches, login successful $this->session->set('customerSessData', $record); return redirect()->to('customer/dashboard')->with('success', 'Welcome to Dashboard'); // Redirect to dashboard or desired page } |