-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomment.php
46 lines (37 loc) · 1.2 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
if(isset($_POST['submit'])){
include_once 'class_comment.php';
if(empty($_POST['comment'])){
echo "<script>alert('Seems Like The comment Posted is empty');</script>";
}else{
$comment=new user_comment($_POST['username'],$_POST['comment'],$_POST['day'],$_POST['post_id']);
$comment->getComments();
echo "<script>
$('.submit-comment-button').html('<img src=loading.gif width=20px height=20px>');
function loaderr(){
$('.submit-comment-button').html('Comment');
$('textarea').val('');
alert('Comment Posted');
}
setTimeout(loaderr,4000);
clearInterval();
</script>";
require 'db.php';
include_once 'timeago.php';
$username=$_POST['username'];
$owner=$_POST['post_owner'];
$post_id=$_POST['post_id'];
if($owner==$_COOKIE['user']){
echo "";
}else{
$username=$_POST['username'];
$owner=$_POST['post_owner'];
$day=$_POST['day'];
$unique_id=$_POST['post_id'];
$duedate=date('Y-m-d');
$sql3="INSERT INTO notifications(sender,details,owner,status,day,location,unique_id,duedate) VALUES('$username','$username commented on your post','$owner',0,'$day','comments','$unique_id','$duedate')";
$result3=mysqli_query($conn,$sql3);
}
}
}
?>