-
Notifications
You must be signed in to change notification settings - Fork 1
/
comment.php
27 lines (23 loc) · 937 Bytes
/
comment.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
<?php
include_once 'connect.php';
$comment = $_POST['comment'];
$post_id = $_GET['post_id'];
$username = $_GET['username'];
$return_to= $_GET['return_to'];
if($comment != null){
$result = mysqli_query($conn, "INSERT INTO
comments(commentername, post_id, comment_text)
values ('$username','$post_id','$comment')"
);
$increment_comments = mysqli_query($conn, " UPDATE posts
SET comments = comments+1
WHERE post_id = $post_id"
);
}
if($return_to == "feed"){
header("Location: feed.php?username=$username");
}else{
header("Location: image-detail.php?post_id=$post_id&curr_us=$username");
}
exit();
?>