after logging in back button can still be activated... |
[eluser]jeanel16[/eluser]
HELP!! ![]() I am new to codeigniter and i am creating a log in page. i just want to prevent the user by clicking the back button after logging in. it means he/she can't access the log in page anymore if he/she is logged in already. I know how to prevent the back button after logging out but after logging in is my problem help pls.....
[eluser]Patrick Spence[/eluser]
[quote author="jeanel16" date="1337650027"]HELP!! ![]() I am new to codeigniter and i am creating a log in page. i just want to prevent the user by clicking the back button after logging in. it means he/she can't access the log in page anymore if he/she is logged in already. I know how to prevent the back button after logging out but after logging in is my problem help pls.....[/quote] How do you tell the user is logged in on other pages? Use that method on your login page, if you detect that the user is logged in either redirect them, display something OTHER than your login form, or log them out so that they can log in again. I use the third choice on my login stuff usually. Not sure this will stop a back button though... simply said though, does it matter that they go back?
[eluser]jeanel16[/eluser]
Im an intern at a company and my trainer as a developer wants all sites to be perfect. what if the user clicks the back button, like facebook if you are logged in and u accidentaly clicked on the back button u'll just stay on ur page, if u click it the second time it will not go back to the log in page but rather at the history of ur browser before the facebook log in page take a try and u'll understand me........ i know how to do that when the user logs out and when they click on the back button it will display an error message because they cant go back to the previous page they must log in first this is what i've used $this->output->set_header("Last-Modified: " . gmdate("D, d M Y H:i ![]() $this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate"); $this->output->set_header("Cache-Control: post-check=0, pre-check=0", false); $this->output->set_header("Pragma: no-cache");
[eluser]jeanel16[/eluser]
here ill explain, i have a controller: public function index() { $this->load->library('form_validation'); $this->form_validation->set_rules('username1', 'Username', 'trim|required'); $this->form_validation->set_rules('password1', 'Password', 'trim|required'); if ($this->form_validation->run() == FALSE) { //if there is a missing requirement if($this->session->userdata('logged_in')) { //it will test the session if it is set right? //the user is logged in $this->load->model('Loginmodel'); $data['data'] = $this->Loginmodel->post_data(); $this->load->view('contactview', $data); } else { //the user is not logged in $this->load->view('loginview'); } else { //if the user has inputted username and password if($this->session->userdata('logged_in')) { //it will again test if the session is set then the user is logged in already it will redirect the user in the contactview. $this->load->model('Loginmodel'); $data['data'] = $this->Loginmodel->post_data(); //inside the post_data() it will select all the data in the database table then post it in the website. it is working i dont have problem with that $this->load->view('contactview', $data); } else { //if it is not yet logged in $this->load->model('Loginmodel'); $this->Loginmodel->login(); if(!$this->Loginmodel->login()) { //the loginmodel contains the admin database that it will compare whether the inputed username and password is correct. $this->load->view('loginview'); } else { $newdata = array( 'username' => 'heidi', 'email' => '[email protected]', 'logged_in' => TRUE ); $user = $this->session->set_userdata($newdata); $this->load->model('Loginmodel'); $data['data'] = $this->Loginmodel->post_data(); $this->load->view('contactview', $data); } } } } } i hope u understand my code ![]()
[eluser]InsiteFX[/eluser]
To get rid of the back button there is only one way to do it jQuery javascript!
[eluser]jeanel16[/eluser]
oh ive solved the problem... thanks for being concerned guys... ![]()
|
Welcome Guest, Not a member yet? Register Sign In |