flow change

This commit is contained in:
2021-09-26 19:40:20 +02:00
parent f82aa4c734
commit b499bb1be0
14 changed files with 364 additions and 221 deletions

View File

@ -1,14 +1,17 @@
<?php
if (!isset($_POST['siteName'])) {
die("Nom du site manquant !<br/><a href='javascript:history.back(1);'>Revenir en arrière</a>");
$siteName = filter_input(INPUT_POST, "siteName", FILTER_SANITIZE_STRING);
if (!$siteName) {
header("Location: 400.php");
exit;
}
include "connect.php";
try {
$insert = $db->prepare("INSERT INTO Sites(Name) VALUES(:name)");
$insert->execute(['name' => $_POST['siteName']]);
header("Location: .?site=${_POST['siteName']}");
exit;
$insert->execute(['name' => $siteName]);
$siteId = $db->lastInsertId();
header("Location: site.php?id=$siteId");
} catch(Exception $e) {
echo($e->getMessage() . "<br/><a href='javascript:history.back(1);'>Revenir en arrière</a>");
header("Location: 500.php");
exit;
}
?>