Disallow invalid event dates.

this froze the simpleevent class
This commit is contained in:
2018-08-09 22:27:28 +02:00
parent b965da0a6c
commit d92e53f0b7
2 changed files with 8 additions and 1 deletions

View File

@@ -35,6 +35,13 @@ $stop = $_POST['end'];
$organiser = $_POST['organiser'];
$location = $_POST['location'];
$start_date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $start);
$stop_date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s', $stop);
if ($start_date >= $stop_date) {
echo 'Invalid dates. End date must come after the start date!';
exit();
}
$statement;
if($id == 0){
$query = 'INSERT INTO events (name, start, stop, organiser, location, description) VALUES (:title, :start, :stop, :organiser, :loc, :desc)';