-
Notifications
You must be signed in to change notification settings - Fork 0
/
commentedit.php
40 lines (34 loc) · 1.11 KB
/
commentedit.php
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
37
38
39
40
<!-- edit comment form handler -->
<!DOCTYPE html>
<html lang="en">
<head>
<link href="fotoapp.css" rel="stylesheet">
<?php
require('db.php');
?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Comment form handler</title>
</head>
<body>
<?php
session_start();
//post id = pid
$pid = $_POST['postid'];
//new comment = new
$new = $_POST['new'];
$new = addslashes($new);
$sql = "UPDATE `post_comment`
SET `Post`='".$pid."',`Comment`='".$new."',
`Time`= CURRENT_TIMESTAMP(),`Comment_User`='".$_SESSION['username']."'
WHERE `Comment_User` like '".$_POST['comment_user']."'
and `Comment` like '".$_POST['comment']."'
and `Time` like '".$_POST['time']."'
and `Post` = '".$pid."'";
$result = $conn->query($sql);
header("Location: ./comment.php?postid=".$pid);
exit();
?>
</body>
</html>