public function login()
{
$this->form_validation->set_rules('email', 'Email', 'required|valid_email');
$this->form_validation->set_rules('password', 'Password', 'required');
if($this->form_validation->run() == FALSE) {
$this->load->view('inc/site_header');
$this->load->view("site_nav");
$this->load->view('login');
$this->load->view('inc/site_footer');
}else{
$post = $this->input->post();
$clean = $this->security->xss_clean($post);
$userInfo = $this->user_model->checkLogin($clean);
if(!$userInfo)
{
$this->session->set_flashdata('flash_message', 'The login was unsucessful');
redirect(site_url().'main/login');
}
else
{
foreach($userInfo as $key=>$val)
{
$this->session->set_userdata($key, $val);
}
$this->session->set_userdata('is_logged_in', TRUE);
redirect(site_url().'atis/');
}
}
}