[eluser]xenogfx[/eluser]
even after enabling database sessions instead of just cookie
Code:
$config['sess_cookie_name'] = 'ci_sessions';
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
Still having issues if you do it to often.
This code is in a controller which redirects based on form submission, it tells the user the details were updated successfully.
Code:
$this->session->set_flashdata('panel_message','success');
redirect(base_url('settings'));
after being executed an uncertain number of times it will just log the user out which makes this bug so annoying.
Entire method
Code:
public function updateAccount() {
$this->form_validation->set_rules('old', 'Old Password', 'trim|min_length[1]');
$this->form_validation->set_rules('new', 'New Password', 'trim|min_length[1]');
$this->form_validation->set_rules('motto', 'Motto', 'trim|min_length[1]');
if ($this->form_validation->run() == FALSE) {
$this->session->set_flashdata('account_message','<span class="label label-danger width-100 pad-5px">There was an error updating your account.</span>');
redirect(base_url('settings'));
} else {
$old_password = sha1($this->input->post('old') . SALT);
$new_password = sha1($this->input->post('new') . SALT);
$motto = $this->input->post('motto');
$success = false;
$get_pass = $this->UserModel->userVar('password',$this->session->userdata('USERNAME'));
if ($old_password && $new_password && $old_password == $get_pass) {
$data = array('password' => $new_password);
if ($this->UserModel->userUpdate($data,$this->session->userdata('ID'))) {
$success = true;
}
}
if ($motto){
$data = array('motto' => $motto);
if ($this->UserModel->userUpdate($data,$this->session->userdata('ID'))) {
$success = true;
}
}
if ($success == TRUE) {
$this->session->set_flashdata('account_message','<span class="label label-success width-100 pad-5px">Updated your account successfully.</span>');
redirect(base_url('settings'));
} else {
$this->session->set_flashdata('account_message','<span class="label label-danger width-100 pad-5px">There was an error updating your account.</span>');
redirect(base_url('settings'));
}
}
}