Skip to content
Advertisement

solving problems in session? [closed]

I have created two pages , one is index.php and admin.php . In the first page or index.php , i have created a loggin form so that i can access the admin.php page trough the loggin or like this enter image description here

Now by logging in i go to admin.php page. Here is the question what i want to ask about that now when ever i click the back button or next button in the chrome. I am returning to the admin.php page . I have tryed the session_start() and the if(!isset($password) || !isset($user)){}. But this code for obvious reasons doesnt work . So can someone help me out with this ?

The code for the example is here index.php

JavaScript

and the code for the admin.php is this one :

JavaScript

Advertisement

Answer

Besides using of session_start you need to store something in the session, using something like this:

JavaScript

which must be set in your login.php and checked by your admin.php if user has access rigths to visit secured page. I.e. you need to check:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement