[eluser]chmod[/eluser]
I wrote the code for my website auth.when I login,then close my browser,
then open the browser again, NO NEED for login agin,why?
but for security,I want to login again.
how to do it?
my code is like these:
-----------------------
class Login extends Controller{
function Login(){
parent::Controller();
}
function _check_username_password($username){
$this->load->model('center/login_model');
$login_result = $this->login_model->ilogin($username);
$password = $this->input->post('password');
$md5password = md5($password);
if ($login_result == $md5password){
return TRUE;
}else{
$this->validation->set_message('_check_username_password','username or password incorrect');
return FALSE;
}
}
function index(){
if ($this->session->userdata('islogin') === TRUE){
$data['title'] = "user center";
$this->load->view('center/mycenter_tpl',$data);
}else{
$username = $this->input->post('username');
$password = $this->input->post('password');
$rules['username'] = "trim|required|xss_clean|callback__check_username_password";
$rules['password'] = "trim|required|xss_clean";
$this->validation->set_rules($rules);
$fields['username'] = "username";
$fields['password'] = "password";
$this->validation->set_fields($fields);
if ($this->validation->run()){
$forward = $this->session->userdata('forward');
$islogin = array('username'=> $username,'islogin' => TRUE,'forward' => $forward);
$this->session->set_userdata($islogin);
if (isset($forward)){
redirect($forward,'refresh');
}else{
$data['title'] = "user center";
$this->load->view('center/mycenter_tpl',$data);
}
}else{
$data['title'] = "user login";
$this->load->view('center/login_tpl',$data);
}
}
}
}