Hate to double post, but I’ll include all of my code… maybe I am indeed doing something seriously stupid. So here we go. In my login controller I have the following
Login.php
function index()
{
$this->load->library('Erkanaauth');
$this->load->library('validation');
/* validation rules for login form */
$rules['email'] = "trim|required|valid_email|xss_clean|callback__verify_login";
$rules['pass'] = "trim|required|xss_clean|md5";
$this->validation->set_rules($rules);
if($this->validation->run() == FALSE) {
$this->load->view('login_view');
} else {
redirect('/', 'refresh');
}
}The function which validates the login within Login.php:
function _verify_login($email)
{
$this->load->helper('security');
$password = dohash($this->input->post('pass'), 'md5');
if($this->erkanaauth->try_login(array('email' => $email, 'password' => $password ))) {
return TRUE;
} else {
$this->validation->set_message('_verify_login', 'Invalid login credentials.');
return FALSE;
}
}At this point I have it set to redirect to ‘/’ which should be my default controller set in routes.php… and here I have simple code:
function index()
{
$this->load->library('Erkanaauth');
if (!$this->erkanaauth->try_session_login()) {
redirect('/login', 'refresh');
}
/* We need to fetch some data to populate into the view.
Retrieve all available CPT codes. */
$data['cpt'] = $this->dbmodel->select_cpt_codes();
/* Retrieve all patients that aren't discharged */
$data['patients'] = $this->dbmodel->select_active_patients();
/* Retrieve current date for CPT population */
$timestamp = time();
$data['current_date'] = date("d M Y", $timestamp);
$this->load->view('landing_page_view2', $data);
}Thanks, I know it’s a lot. Would definitely owe ya big time if you catch a stupid mistake I’ve made.