[eluser]mattbman[/eluser]
I have just installed CI and for some reason, my models are not properly loading the libraries. Here is my code for my model:
Code:
class Usermodel extends Model {
function Usermodel() {
parent::Model();
}
function login() {
if ($this->input->post('username') && $this->input->post('password')) {
if ($this->checkpassword($this->input->post('username'),$this->input->post('password'))) {
$this->session->set_userdata('username',$this->input->post('username'));
}
}
}
function logoff() {
$this->session->unset_userdata('username');
}
function checkpassword($username,$password) {
$query = $this->db->query("SELECT * FROM users WHERE username='".$username."'");
$obj = $query->result();
$obj = $obj[0];
if (md5($password)==$obj->password) {
return TRUE;
} else {
return FALSE;
}
}
}
I need session and database, and I have tried the autoload, I have tried loading in the individual functions, and in the constructor and nothing seems to work. Is there something I am missing?