diff --git a/html/editpage.php b/html/editpage.php index 4b0c2b41..fd05235d 100644 --- a/html/editpage.php +++ b/html/editpage.php @@ -51,13 +51,13 @@ if(isset($fichier)) { if(isset($_POST['page-content'])) { file_put_contents($fichier, nl2br($_POST['page-content'])); } - if(isset($_POST['classification']) && isset($_POST['image']) && isset($_POST['resume']) && isset($_GET['article'])) { + if(isset($_POST['article-classification']) && isset($_POST['article-image']) && isset($_POST['article-resume']) && isset($_GET['article'])) { $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); $req = $bdd->prepare("UPDATE articles SET classification = :classification, titre = :titre, resume = :resume WHERE ID = :article"); - $req->bindParam(':classification', $_POST['classification']); - $req->bindParam(':titre', $_POST['titre']); - $req->bindParam(':resume', $_POST['resume']); + $req->bindParam(':classification', $_POST['article-classification']); + $req->bindParam(':titre', $_POST['article-titre']); + $req->bindParam(':resume', $_POST['article-resume']); $req->bindParam(':article', $_GET['article']); if($req->execute()) { $status = "Informations mises à jour"; @@ -137,7 +137,7 @@ if(isset($fichier)) { $resultat = $req->fetchAll(PDO::FETCH_ASSOC); if($resultat) { - echo '
'; foreach($classifications as $id => $nom) { if((int)$resultat[0]['classification'] == $id) { echo ''; @@ -151,6 +151,7 @@ if(isset($fichier)) { echo '
'; echo '
'; + echo '
'; } } echo "

" . $filename . "

"; diff --git a/html/upload.php b/html/upload.php index cb566830..18e58d82 100644 --- a/html/upload.php +++ b/html/upload.php @@ -14,13 +14,15 @@ while(file_exists($wwwroot . "/content/journal/" . $filename . ".md")) { $filename = rand(100000, 999999); } -if(isset($_POST['page-content'])) { +if(isset($_POST['article-content'])) { file_put_contents($wwwroot . "/content/journal/" . $filename . ".md", nl2br($_POST['page-content'])); $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); - $upload = $bdd->prepare("INSERT INTO articles (ID, titre, auteur, classification) VALUES (:filename, :titre, :auteur, :classification)"); + $upload = $bdd->prepare("INSERT INTO articles (ID, titre, auteur, classification) VALUES (:filename, :titre, :auteur, :image, :resume, :classification)"); $upload->bindParam(':filename', $filename); - $upload->bindParam(':titre', htmlspecialchars($_POST['titre'])); + $upload->bindParam(':titre', htmlspecialchars($_POST['article-titre'])); + $upload->bindParam(':image', htmlspecialchars($_POST['article-image'])); + $upload->bindParam(':resume', htmlspecialchars($_POST['article-resume'])); $upload->bindParam(':auteur', $_SESSION['display_name']); $upload->bindParam(':classification', $_POST['classification']); if($upload->execute()) { @@ -90,9 +92,12 @@ if(isset($_POST['page-content'])) {

Publier un article

-
-
+
+
+
+
+