diff --git a/html/compte.php b/html/compte.php index fb7abcc9..88cf5735 100644 --- a/html/compte.php +++ b/html/compte.php @@ -9,23 +9,27 @@ if(isset($_SESSION['userid']) == false) { } if(isset($_POST['delete_account'])) { - $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); + $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); $req = $bdd->prepare("DELETE FROM users WHERE ID = :id"); $req->bindParam(':id', $_SESSION['userid']); + if($req->execute()) { header("Location: logout.php"); exit(); } else { die("Erreur SQL"); } -} else if (isset($_POST['display_name']) && isset($_POST['email'])){ - $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); - $req = $bdd->prepare("UPDATE users SET display_name = :display_name, email = :email WHERE ID = :userid"); - $req->bindParam(':display_name', $_SESSION['display_name']); - $req->bindParam(':email', $_SESSION['email']); +} else if (isset($_POST['display_name']) && isset($_POST['email'])) && isset($_POST['username']) { + + $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); + $req = $bdd->prepare("UPDATE users SET display_name = :display_name, email = :email, username = :username WHERE ID = :userid"); + $req->bindParam(':display_name', htmlspecialchars($_POST['display_name'])); + $req->bindParam(':email', htmlspecialchars($_POST['email'])); + $req->bindParam(':username', htmlspecialchars($_POST['username'])); $req->bindParam(':userid', $_SESSION['userid']); + if($req->execute()) { $status = "Informations mises à jour"; } else { @@ -114,6 +118,7 @@ if(isset($_POST['delete_account'])) { "; echo "
"; + echo "
"; echo "
"; ?>
diff --git a/html/editpage.php b/html/editpage.php index c213b185..1ccdb6b9 100644 --- a/html/editpage.php +++ b/html/editpage.php @@ -188,6 +188,7 @@ if(isset($fichier)) { echo "
" . $row['ID'] . "
"; } } + echo ""; } ?> diff --git a/html/news.php b/html/news.php index 770fbd6f..f3a9b1e7 100644 --- a/html/news.php +++ b/html/news.php @@ -58,6 +58,7 @@ if (isset($_GET['article']) && filter_var($_GET['article'], FILTER_VALIDATE_INT)
prepare("SELECT ID, titre, date, auteur FROM articles WHERE (titre LIKE :search OR ID LIKE :search OR auteur LIKE :search) AND classification <= :accreditation ORDER BY date DESC"); @@ -82,12 +83,14 @@ if (isset($_GET['article']) && filter_var($_GET['article'], FILTER_VALIDATE_INT) } else { echo "Aucun article trouvé"; } + } else if (!isset($_GET['search']) && $article != "" && file_exists($wwwroot . '/content/journal/' . $article . '.md')) { + $markdownContent = file_get_contents($wwwroot . '/content/journal/' . $article . '.md'); require_once '../include/parsedown.php'; $parsedown = new Parsedown(); - echo "
"; + $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); $req = $bdd->prepare("SELECT ID, titre, date, auteur, classification FROM articles WHERE ID = :article AND classification <= :accreditation"); $req->bindParam(":article", $article); @@ -97,6 +100,7 @@ if (isset($_GET['article']) && filter_var($_GET['article'], FILTER_VALIDATE_INT) if ($resultat) { $date = strtotime($resultat[0]['date']); + echo "