Session start after auth:
session_regenerate_id();
$_SESSION['loggedin'] = TRUE;
$_SESSION['name'] = $_POST['username'];
$_SESSION['id'] = $id;
header("location: main.php");
And then on every page i use:
session_start();
// If the user is not logged in redirect to the login page
if (!isset($_SESSION['loggedin'])) {
header('Location: index.php');
exit;
}
How to improve security over all question. Also how to improve it without SSL
Aucun commentaire:
Enregistrer un commentaire