diff --git a/website/queries/settings.php b/website/queries/settings.php index f4c5403..6c52fc4 100644 --- a/website/queries/settings.php +++ b/website/queries/settings.php @@ -110,20 +110,30 @@ function updateSettings() { WHERE `userID` = :userID "); + $bday = new DateTime(test_input($_POST["year"] . $_POST["month"] . $_POST["day"])); + checkBday($bday); $stmt->bindValue(":fname", test_input($_POST["fname"])); $stmt->bindValue(":lname", test_input($_POST["lname"])); $stmt->bindValue(":location", test_input($_POST["location"])); - $stmt->bindValue(":bday", test_input($_POST["bday"])); + $stmt->bindValue(":bday", $bday->format("Ymd")); $stmt->bindValue(":bio", test_input($_POST["bio"])); $stmt->bindValue(":showEmail", test_input($_POST["showEmail"])); - $stmt->bindValue(":showBday", test_input($_POST["showBday"])); + $stmt->bindValue(":showBday",test_input($_POST["showBday"])); $stmt->bindValue(":userID", $_SESSION["userID"]); $stmt->execute(); throw new HappyAlert("Instellingen zijn opgeslagen."); } +function checkBday(DateTime $bday) { + $today = new DateTime(); + if ($bday >= $today) { + throw new AngryAlert("Jij bent vast niet in de toekomst geboren toch? ;)"); + } +} + + /** * Change * @throws AngryAlert diff --git a/website/views/settings-view.php b/website/views/settings-view.php index b6a3b4c..1079c91 100644 --- a/website/views/settings-view.php +++ b/website/views/settings-view.php @@ -44,37 +44,68 @@ $settings = getSettings();
  • - " - > + + + +
  • + > Ja + > Nee
  • + > Ja + > Nee
  • @@ -189,4 +220,4 @@ $settings = getSettings(); - \ No newline at end of file +