-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbillet.php
More file actions
36 lines (25 loc) · 1.03 KB
/
Copy pathbillet.php
File metadata and controls
36 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include 'connexion.php';
$titre = $_POST['titre'];
$date = $_POST['date'];
$contenu = $_POST['contenu'];
if (
isset($_POST['titre'], $_POST['date'], $_POST['contenu'], $_FILES['photo_billet'])
&& !empty($_POST['titre'])
&& !empty($_POST['date'])
&& !empty($_POST['contenu'])
&& $_FILES['photo_billet']['error'] === 0
) {
$dossier = "photos_billets/";
$nomFichier = basename($_FILES['photo_billet']['name']);
$chemin = $dossier . $nomFichier;
move_uploaded_file($_FILES['photo_billet']['tmp_name'], $chemin);
$photo_billet = $chemin;
$stmt = $db-> prepare("INSERT INTO billets (date, titre, contenu,photo_billet, id_auteur) VALUES (?,?,?,?,1)");
$stmt->execute([$date, $titre, $contenu, $photo_billet]);
}
header("Location: index.php");
/* $stmt = $db-> prepare("INSERT INTO billets (date, titre, contenu,photo_billet, id_auteur) VALUES (?,?,?,$photo_billet,1)");
$stmt->execute([$date, $titre, $contenu, $photo_billet]);
*/
?>