Welcome Guest, Not a member yet? Register   Sign In
jQuery login problem
#1

[eluser]Unknown[/eluser]
Hi, for the login on my new application i use this function in the controller login:

Code:
function process()
    {
        /** Set form validation rules **/
        $this->form_validation->set_rules('username', 'userName', 'required|trim');
        $this->form_validation->set_rules('userpass', 'userPass', 'required|trim');
        
        /** Validate the form **/
        if ($this->form_validation->run() == false)
        {
            /** Validate not valid **/
            echo false;
            
            /** Redirect to the login **/
            redirect('login');
        }
        else
        {
            /** Read the form inputs **/
            $userName = $this->input->post('username');
            $userPass = $this->input->post('userpass');
            
            /** Call the model with the form inputs **/
            $userLogin = $this->login_model->userLogin($userName, $userPass);
            
            /** Check if the user can be logged in **/
            if ($userLogin == false)
            {
                /** User not logged in **/
                echo false;
            }
            else
            {
                /** Check now if the account is enabled **/
                if ($this->session->userdata('userActive') == 1 && $this->session->userdata('userID') > 0)
                {                    
                    /** Log this into the database **/
                    $this->login_model->loginHistory();
                    
                    /** Account is active **/                    
                    echo true;
                }
                else
                {
                    /** User not logged in **/
                    echo false;
                }
            }
        }
    }

Via my jQuery i post to the page above: login/process. When i use Firebug in Firefox it don't give errors when i remove the form validation rules in the script above, but it will still nog login. It have worked, but still not for now. The echo's in the script above is for the jquery validation.

When u need more code. Please tell me!




Theme © iAndrew 2016 - Forum software by © MyBB