Allowing users to Refresh browser without the “Confirm Form Resubmission” pop-up

前端 未结 2 1412
野性不改
野性不改 2020-12-03 03:58

I have a login system, and while logged in, if I refresh the browser, Chrome shows a pop up window titled \"Confirm Form Resubmission.\" I assume that the same thing would

相关标签:
2条回答
  • 2020-12-03 04:53

    Alright, so at the top of you login page, you can just have this:

    <?php
    if (isset($_POST['username'])) {
    // Do you login stuff here....
    
    if ($passed == true) {
        header('Location: index.php');
    } else {
        echo "Invalid username/password!";
    }
    
    0 讨论(0)
  • 2020-12-03 04:58

    After processing the POST page, redirect the user to the same page.

    On http://test.com/test.php

    header('Location: http://test.com/test.php');
    

    This will get rid of the box, as refreshing the page will not resubmit the data.

    0 讨论(0)
提交回复
热议问题