Date picker in bday

This commit is contained in:
Marijn Jansen
2017-01-30 21:48:18 +01:00
parent b30ef0d0cf
commit 422e2d1308
2 changed files with 54 additions and 13 deletions

View File

@@ -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