开发者

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

开发者 https://www.devze.com 2022-12-22 16:35 出处:网络
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 happen with other bro开发者_运

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 happen with other bro开发者_运维技巧wsers.

How can I allow the browser to be refreshed without this confirmation pop-up window? Of course, I would also like to stay logged in while refreshing the browser.


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.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号