简体   繁体   中英

CodeIgniter 404 Bad request error

I'm working with codeIgniter. I am making a login form which checks the members details with the database.

However when I click to login I get this error message:

The requested URL /waitronmain/login.php/login/validate_credentials was not found on this server.

However this is my login.php file and as you can see validate_credentials() does exist.

class Login extends CI_Controller{


function index()
{
    $data['main_content'] = 'login_form';
    $this->load->view('includes/template', $data);
}

function validate_credentials()
{
    //load model to query db
    $this->load->model('membership_model');
    $query = $this->membership_model->validate();

    if($query){ //if credentials validated
        $data = array(
            'username' => $this->input->post('username'),
            'is_logged_in' => true

            );

            $this ->session->set_userdata($data);
            redirect('site/members_area');
    }

    else{ //if not validated load login form again.
        $this->index();

    }

}

}

Any idea what's going wrong? I should be going on to the 'members_area' page as I know the details I am entering are correct.

Any help would be much appreciated.

what is this??

/waitronmain /login.php/ login/validate_credentials

login.php should be not in url i think you should do:

/waitronmain/login/validate_credentials

(assuming you removed index.php from urls and you are inside the waitronmain/ root )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM