Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter - Could still access the member's page after logging out when back button is clicked
    primarykey
    data
    text
    <p>I am using <strong>CodeIgniter</strong>.</p> <p>After I logon to the member's and click logout, I could still view the member's page when I click the BACK button. </p> <p><strong>Question</strong> Does anyone know so that if the user has logged out, it could not access the Member's page even clicking of BACK button?</p> <p>Please see my code below..</p> <p>Thanks..</p> <pre><code> class Site extends CI_Controller{ function index() { if(!isset($this-&gt;session-&gt;userdata['is_loggged_in'])) $this-&gt;login(); else $this-&gt;_template(); } function login() { $data['main_content'] = 'login_form'; $data['page_title'] = 'Login - php'; $this-&gt;load-&gt;view('include/template' , $data); } function validate() { $this-&gt;load-&gt;library('form_validation'); $this-&gt;form_validation-&gt;set_rules('username' , 'Username' , 'trim|required' ); $this-&gt;form_validation-&gt;set_rules('password' , 'Password' , 'trim|required' ); if($this-&gt;form_validation-&gt;run() == FALSE) { $this-&gt;login(); } else { $this-&gt;load-&gt;model('member_model' , 'member'); $query = $this-&gt;member-&gt;checklogin(); //login successful , make sure no duplicate entry during registration if($query-&gt;num_rows() == 1) { $data = array( 'is_loggged_in' =&gt; TRUE , 'username' =&gt; $this-&gt;input-&gt;post('username'), ); $this-&gt;session-&gt;set_userdata($data); $this-&gt;_template(); } else { $data = array( 'main_content' =&gt; 'login_form' , 'page_title' =&gt; 'Error login' , 'page_error' =&gt; 'Invalid Username or password. ' ); $this-&gt;load-&gt;view('include/template' , $data); } } } function _template() { $data = array( 'main_content' =&gt; 'include/default_inc', 'page_title' =&gt; 'Welcome home ran' ); $this-&gt;load-&gt;view('include/template' , $data); } function logout() { $this-&gt;session-&gt;sess_destroy(); redirect('site/login'); exit; } } /* end of controller site */ </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload