-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsubmitcomment.php
More file actions
28 lines (26 loc) · 860 Bytes
/
submitcomment.php
File metadata and controls
28 lines (26 loc) · 860 Bytes
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
<?php session_start();
require_once 'config.php';?>
<?php
if (isset($_GET['comment'])){
$comment=htmlspecialchars($_GET['comment']);
try {
$select = $bdd->prepare(
'SELECT id from users where email like ?'
);
$select->execute(array(strval($_SESSION['email'])));
$data=$select->fetch();
$userId=$data['id'];
$userId=intval($userId);
$insert = $bdd->prepare(
'INSERT INTO commentaire (comment, userId) VALUES (:comment, :userId )');
$insert->execute([
'comment' => $comment,
'userId' => $userId,
]);
$a="insertion reussie";
header('Location:aide.php?value=comment');
} catch (Exception $e) {
die('Erreur : ' . $e->getMessage());
}
}
?>