I am trying to develop a registration system.
Registration Info -> Subscription -> Success page
While submitting the user information, I created a session_data
and in the Success page controller
, I unset the session so that the user cannot go back to the subscription page.
The subscription
and success
controller is restricted if session data
is not set.
Subscription Controller & Success Controller
public function __construct()
{
parent::__construct();
if (! $this->session->userdata('st_guid'))
{
redirect('register');
}
}
And in Success Controller Index I unset the userdata.
public function index()
{
$this->load->view('success');
// Unset session data
$this->session->unset_userdata('st_guid');
$this->session->sess_destroy();
}
Problem is, if I click the browser back button it easily load the subscription
page and click the forward button it loads the success
page while I already unset the session data. If I refresh the page only then the session data getting destroyed and redirected to registration
page.
What should I do ?
I am using Codeigniter 2.2.6