Login with email or username in codeigniter

function login_user()
{
 $email= $this->input->post('email');
 $password= MD5($this->input->post('password'));
 $this->db->where("(Email='$email' OR Username='$email') AND Password='$password' ");
 $Query = $this->db->get('users');
 if($Query->num_rows() > 0)
 {
  return $Query->row();
 }
 else
 {
  return false;
 }
}

Comments

Popular posts from this blog

Creating Protected routes in ReactJS

Add and use wow.js into WordPress theme