Update file upload.php

This commit is contained in:
Jan BELLON 2024-03-07 17:41:32 +00:00
parent 4f71b03fb7
commit cac5e98ac7

View File

@ -12,10 +12,10 @@ if(isset($_SESSION['userid']) == false) {
if(isset($_POST['page-content'])) {
$filename = rand(100000, 999999);
while(file_exists($repertoire . "content/" . $filename)) {
while(file_exists($repertoire . "content/journal" . $filename)) {
$filename = rand(100000, 999999);
}
file_put_contents($repertoire . "content/" . $filename, nl2br($_POST['page-content']));
file_put_contents($repertoire . "content/journal" . $filename, nl2br($_POST['page-content']));
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
$upload = $bdd->prepare("INSERT INTO articles (ID, titre, date, auteur) VALUES (:filename, :titre, :date, :auteur)");