From 949737cf5fc2a21b36c4a269a437d0dc2e965441 Mon Sep 17 00:00:00 2001 From: polo Date: Fri, 9 Feb 2024 15:56:55 +0100 Subject: 1er commit --- articles/ajoutarticle.php | 103 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 articles/ajoutarticle.php (limited to 'articles/ajoutarticle.php') diff --git a/articles/ajoutarticle.php b/articles/ajoutarticle.php new file mode 100644 index 0000000..56f63a1 --- /dev/null +++ b/articles/ajoutarticle.php @@ -0,0 +1,103 @@ +prepare('INSERT INTO articles (nomarticle, contenu, nomphoto, miniature) VALUES (?, ?, ?, ?)'); + $requête->execute(array( + $_POST['titre'], + $_POST['article'], + $nom, + $mini_nom)); + + // création de la miniature + include("miniatures.php"); + + header('Location: ../administration.php?nouvarticle=5'); // succès, move_uploaded_file renvoie la valeur TRUE + exit (); + } + else // echec à l'enregistrement, la fonction renvoie FALSE + { + header('Location: ../administration.php?nouvarticle=4'); + exit (); + } + } + else // mauvais format + { + header('Location: ../administration.php?nouvarticle=3'); + exit (); + } +} +elseif ($_POST['titre'] != '') // article sans photo +{ + $requête = $base->prepare('INSERT INTO articles (nomarticle, contenu) VALUES (?, ?)'); + $requête->execute(array( + $_POST['titre'], + $_POST['article'])); + + header('Location: ../administration.php?nouvarticle=5'); + exit (); +} +else // pas de titre +{ + header('Location: ../administration.php?nouvarticle=1'); +} +?> -- cgit v1.2.3