i have two page the login page(login.php) and the userpanel page(userpanel. php)
in the login page whenever i put in the username and password then i click submit
it will get the userpanel page but the problem is whenever i am in the userpanel page and i click the back option on top of the browser it will take me back to the login page how can i fix this problem
in the login page whenever i put in the username and password then i click submit
it will get the userpanel page but the problem is whenever i am in the userpanel page and i click the back option on top of the browser it will take me back to the login page how can i fix this problem
Code:
<?
login.php
session_start();
if(isset($_GET['try'])) {
If(empty($_POST['username']) OR empty($_POST['password'])) {
echo 'Please fill in all the required fields';
} else {
$username = mysql_real_escape_string($_POST['username']);
$password = md5($_POST['password']);
$query = mysql_query("SELECT id FROM account
WHERE username = '" . $username . "'
AND password = '" . $password . "'
") or die(mysql_error());
list($user) = mysql_fetch_row($query);
if(empty($user)) {
echo 'No combination of username and password found';
} else {
$_SESSION['user'] = $user;
header('location: userpanel.php');
}
}
}
?>
Comment