[eluser]chmod[/eluser]
if i was you,i can write the the below:
controller:
$username = $this->input->post('username');
$password = $this->input->post('password');
$result = $this->model->check_user($username,$password);
if ($result)
{
//login
}else{
echo "Username and/or Password not recognized - Please try again.";
}
model:
class Login extends Model {
function login()
{
parent::Model();
$this->load->database();
}
function check_user($username,$password)
{
$query = $this->db->get_where('auth_users',array('username' => $username, 'password' => $password)) ;
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$un = $row->username;
$pw = $row->password;
if ($un == $username and $pw == $password)
{
return true;
}
}
}else{
return false;
}
}
}