Welcome Guest, Not a member yet? Register   Sign In
what happen is error with redirect to codeigniter 4.3.3
#1

(This post was last modified: 04-04-2023, 12:10 AM by startup.)

i have function below, but redirect() ->to('auth/home'); dont work, can someone show me what is error?
Code:
404
Sorry! Cannot seem to find the page you were looking for.


PHP Code:
public function check(){

        $validation $this->validate([
            'email' => [
                'rules'  => 'required|valid_email|is_not_unique[users.email]',
                'errors' => [
                    'required' => 'Email is required.',
                    'valid_email' => 'Please check the Email field. It does not appear to be valid.',
                    'is_not_unique' => 'Email not registered in our server.',
                ],
            ],
            'password' => [
                'rules'  => 'required|min_length[5]|max_length[20]',
                'errors' => [
                    'required' => 'Password is required.',
                    'min_length' => 'Password must have atleast 5 characters in length.',
                    'max_length' => 'Password must not have characters more thant 20 in length.',
                ],
            ],
        ]);

        if(!$validation){
            return  redirect()->to('auth/login')->with('validation'$this->validator)->withInput();
        }else{
            $email $this->request->getPost('email');
            $password $this->request->getPost('password');
            $userModel = new UserModel();
            $user_info $userModel->where('email'$email)->first();

            $check_password Hash::check($password$user_info['password']);
            if( !$check_password ){
                return  redirect()->to('auth/login')->with('fail''Incorect password.')->withInput();
            }else{
                $session_data = ['user' => $user_info];
                session()->set('LoggedUser'$session_data);
                $data['xin_chao']='abc';
              
                return  redirect
()->to('auth/home');

            }
        }
    

thank you for reading
Reply


Messages In This Thread
what happen is error with redirect to codeigniter 4.3.3 - by startup - 04-04-2023, 12:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB