[eluser]Shannon[/eluser]
I am trying to make a login page from a tutorial. Whenever I submit the form, it says it can't locate the model I am trying to access.
membership_model.php
Code:
<?php
class Membership_model extends CI_Model {
function validate() {
$this->db->where('username', $this->input->post('username'));
$this->db->where('password', md5($this->input->post('password')));
$query = $this->db->get('lightpanel_login');
if ($query->num_rows == 1) {
return true;
}
}
}
?>
login.php
Code:
<?php
class Login extends CI_Controller {
function __construct() {
parent::__construct();
}
function index() {
$data['main_content'] = 'login_form';
$this->load->view('includes/template', $data);
}
function validate_credentials() {
$this->load->model('membership_model');
$query = $this->membership_model->validate();
if($query)
{
$data = array(
'username' => $this->input->post('username'),
'is_logged_in' => true
);
$this->session->set_userdata($data);
redirect('index/members_area');
}
else
{
$this->index();
}
}
}
?>
I can't really know how to explain it, so if you can ask me questions to try manipulate the problem I will be more than happy to answer them.
Also, today is my first day using CI.
Thanks,
Shannon.