All articles

October 29, 2026 · 1 min read · 65 views

Why Post/Redirect/Get still matters

PHPWeb Security

The problem

When a form POSTs and the server answers with a page, pressing refresh re-sends the form. That is how duplicate orders and duplicate comments happen.

The fix

After handling the POST, redirect to a GET URL. The browser then reloads a harmless page.
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    save($_POST);
    header("Location: /thanks.php", true, 303);
    exit;
}

Use a 303 status so the browser always switches to GET.

Keep reading

K

Oct 29, 2026 · 1 min read

Keeping a PHP codebase DRY without a framework

A handful of well-named helper functions can remove most of the repetition from a plain PHP project.

PHPArchitecture
WhatsApp