Session Not Destroy - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Session Not Destroy (/showthread.php?tid=11217) |
Session Not Destroy - El Forum - 08-30-2008 [eluser]ahora[/eluser] Hello this see in code <?PHP class admin extends Controller { function desktop() { $this->load->library('session'); if(!$this->session->userdata('login')) header('location: ../login/'); echo $this->session->userdata('login') .'<br>' .'<a href="../logout/">logout</a>'; } function login() { $this->load->library('session'); $this->load->database(); $sHtml['title'] = 'Please Login'; $login['user'] = $this->input->post('nitUserAdmin', true); $login['pass'] = $this->input->post('nipPassAdmin', true); $login['erro'] = 'NO'; if($this->input->post('nihFrmLoginAdmin')){ $query = "SELECT * FROM admin WHERE username='" .$login['user'] ."' AND password='" .$login['pass'] ."'"; $query = $this->db->query($query); $numRow = $query->num_rows(); if($numRow == 1){ $this->session->set_userdata('login', $login['user']); header('location: ../desktop/'); } else{ $login['erro'] = 'username/password invalid'; } } $this->load->view('admin/sHtml', $sHtml); $this->load->view('admin/login', $login); $this->load->view('admin/eHtml'); } function logout() { $this->load->library('session'); $this->session->unset_userdata('login'); header('location: ../login/'); } } ?> This is Problem.... when this page back.... refresh page show admin.... Session Not Destroy - El Forum - 08-30-2008 [eluser]Bramme[/eluser] very sorry, but you'll have to try and explain your problem a bit better. I'd love to help but I simply can't understand what you mean... Session Not Destroy - El Forum - 08-30-2008 [eluser]ahora[/eluser] yes when want logout... click on logout and move to page login ok ? now click on back .... move to page replay admin ok? now i want when click on back .... replay move to login .. because user is logout . ok ? Session Not Destroy - El Forum - 08-30-2008 [eluser]Colin Williams[/eluser] We don't even see a 'replay' controller function? What are we missing? Sounds to me like if a user logs out, they are logged out and shouldn't have access to the admin functions. So where exactly is the problem? Session Not Destroy - El Forum - 08-30-2008 [eluser]ahora[/eluser] I problem To Spleak Engish I am Speak Persian can you Speak Persian ? Session Not Destroy - El Forum - 08-30-2008 [eluser]mglinski[/eluser] Replace Code: $this->session->unset_userdata('login'); Code: $this->session->sess_destroy(); Session Not Destroy - El Forum - 08-30-2008 [eluser]Colin Williams[/eluser] There might be parts of the session he wants to maintain. Session Not Destroy - El Forum - 08-31-2008 [eluser]mglinski[/eluser] Then why not save those parts in an array from the current session, destroy the old one, and then create a new one? The removal function does not seem to be working as expected. -Matt Session Not Destroy - El Forum - 08-31-2008 [eluser]Colin Williams[/eluser] The removal function works fine. If you don't think so, try it out yourself. If you can produce a case where it fails, show us. The problem, I believe, is elsewhere. We're just having a bit of trouble communicating to get at that place. |