Update 3 files

- /html/journal.php
- /html/login.php
- /html/upload.php
This commit is contained in:
Jan BELLON 2024-03-07 01:25:36 +00:00
parent bbb08b9a83
commit 23e26a287c
3 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) {
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$req = $bdd->prepare("SELECT (ID, titre, date, auteur) FROM articles ORDER BY date DESC");
$bdd->execute();
$resultat = $req->fetch(PDO::FETCH_ASSOC);
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
if ($resultat) {
foreach($resultat as $row) {

View File

@ -16,7 +16,7 @@ if(isset($_POST['username']) && isset($_POST['password'])) {
$bdd->bindParam(':password', md5($_POST['password']));
$bdd->execute();
$resultat = $req->fetch(PDO::FETCH_ASSOC);
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
if ($resultat) {
$_SESSION['username'] = $resultat[0]['username'];

View File

@ -11,7 +11,7 @@ if(isset($_POST['title']) && isset($_FILES['file'])) {
$filename = date("YmdHis");
$destination = "../content/journal/" . $filename;
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$insertcred = $bdd->prepare("INSERT INTO articles (ID, titre, date, auteur) VALUES (:filename, :titre, :date, :auteur)");
$upload = $bdd->prepare("INSERT INTO articles (ID, titre, date, auteur) VALUES (:filename, :titre, :date, :auteur)");
$bdd->bindParam(':filename', $filename);
$bdd->bindParam(':titre', htmlspecialchars($_POST['titre']));
$bdd->bindParam(':auteur', $_SESSION['display_name']);
@ -20,7 +20,7 @@ if(isset($_POST['title']) && isset($_FILES['file'])) {
} else {
$bdd->bindParam(':date', date());
}
$insertcred->execute();
$upload->execute();
move_uploaded_file($_FILES['file']['tmp_name'], $destination);
}