I develop a registration system using codeigniter. I don't want the user to have multiple session active. ie user login with a username and password on chrome browser and now goes to firefox and login with the same username and password.
//I added a column calld userid
ci_sessions // codeigniter session database
//check whether a session exist and delete
$this->db->delete('ci_sessions',array('userid' => $this->input->post('reg_nos')));
//create a session data
$this->session->set_userdata(array('reg_nos'=>$this->input->post('reg_nos')));
//get the current session and update it with the userid value.
$session_id = $this->session->userdata('session_id');
$this->db->where('session_id', $session_id);
$this->db->update('ci_sessions', array('userid' => $this->input->post(reg_nos')))
Is there a better to implement this? I can't even get it to work.