0
votes

The problem is after i logout, then press back button or go to user_control/login, then refresh, i wasn't redirected to the log in page but rather at the home page.

I unset and destroyed the session already.

One solution i found from the web is no cache. It works but it prompts for the resubmission of form and when i refresh i wasn't redirected to the login page but rather at the home page.

> controller: user_control 
> function: login 
> algorithm:
>      1. form validation set rules
>      2. get posts of username and password
>      3. check if the username is in the database and entered password is equal to the password in the database, if true go to 4. else go to signin page.
    >  4. set session
    >  5. load view home.php

I suspect, everytime i press the back button, the post request is still there, and when i refresh, it calls the user_control/login with the posts credentials of the form.

1

1 Answers

0
votes

You need to restrict your home page or any other pages to only logged in users. Redirect others to the login page. Have a look at Ion Auth documents for an example of how this can be done.