jeudi 9 février 2017

prevent form resubmission dialog with php header() and $_SESSION

Vote count: 0

I have a landing page for users who have just logged in. The idea is that it handles the login the first time, then they may click away to another page. The problem is that when they user the back button to return to their landing page, the 'confirm form resubmission' error is displayed by the browser. I am trying to avoid this by using $_SESSION to handle them already being logged in and header() to prevent the dialog, (as suggested on another question) but it isn't working.

code:

$loggedIn = $_SESSION['logged_in'];
if($loggedIn == true) {
    //no need to do login check
} else {
    $email = $_POST['email'];
    $password = $_POST['password'];
    //do login check
    $_SESSION['logged_in'] = true;
    header('Location: http://ift.tt/Q5npPM');
}

I am not too clear on what exactly header() does (even after reading the manual page on it). Have I got something wrong here or is it just not capable of doing what I want in the first place?

asked 9 secs ago

Let's block ads! (Why?)



prevent form resubmission dialog with php header() and $_SESSION

Aucun commentaire:

Enregistrer un commentaire