From 761732cd1bebb7484d41812f5223da23cc46bf80 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Mon, 9 Mar 2020 21:15:28 -0600 Subject: [PATCH] Fix crash on empty form submit --- public/actions/submit.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/actions/submit.php b/public/actions/submit.php index cc46318..bdc4d65 100644 --- a/public/actions/submit.php +++ b/public/actions/submit.php @@ -11,8 +11,8 @@ require_once __DIR__ . "/../../lib/requiredpublic.php"; require_once __DIR__ . "/../../lib/Email.lib.php"; function errorBack(string $errormsg) { - global $familyid; - //header("Location: ../?page=signup&error=" . htmlentities($errormsg)); + global $familyid, $database; + header("Location: ../?page=signup&error=" . htmlentities($errormsg)); $database->delete("families", ["familyid" => $familyid]); die($errormsg); } @@ -31,6 +31,10 @@ $database->action(function($database) { $emails = []; + if (!isset($_POST["people"]) || empty($_POST["people"])) { + errorBack("You need to register at least one person."); + } + try { $people = $_POST['people'];