The Problem is when I logged-in in my admin and go to other view forms from my admin and click back or go back the browser will display an error. and it says "Document Expired".
This is the Controller:
public function validate()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('user', 'Username', 'required');
$this->form_validation->set_rules('pass', 'Password', 'required');
if($this->form_validation->run())
{
//true
$username = $this->input->post('user');
$password = $this->input->post('pass');
//model function
$this->load->model('add_mod');
$query = $this->add_mod->can_login($username, $password);
$session_data = array(
'id' => $query['id'],
'user' => $query['user']
);
$this->session->set_userdata($session_data);
if($query)
{
$data['title'] = "Welcome ". $query['user'];
$this->load->view('templates/header', $data);
$this->load->view('admin/home', $data);
$this->load->view('templates/footer', $data);
}
else
{
$this->session->set_flashdata('error', 'Invalid Username and Password');
redirect(base_url() . 'admin/login');
}
}
else
{
//false
$this->login();
}
}
This is the model
public function can_login($username, $password)
{
$this->db->where('user', $username);
$this->db->where('pass', $password);
$query = $this->db->get('accounts');
if($query->num_rows() > 0)
{
return $query->row_array();
}
else
{
return false;
}
}
That's mostly my problem and stackoverflow won't let me post this because its mostly code here thanks in advance. More power from Philippines