-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpo.php
102 lines (84 loc) · 2.08 KB
/
po.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php ob_start(); ?>
<?php
session_start();
$user_id = $_SESSION['user_id'];
?>
<?php
if(!$user_id){
header("location: index.php");
exit;
}
?>
<?php
$post_id = $_GET[value1];
$post_id1 = $_GET[value2];
$postd = $_GET[pid];
if($post_id){
$follow_userid = $_GET[user];
$comid = $_GET[comment_id];
$ref = $_GET[ref];
$timestamp = time();
$timestap = time();
$content = "voted your poll";
$type = "poll";
include "connect.php";
if(mysqli_num_rows($query23)>=1){
$del="DELETE FROM poll
WHERE post_id='$postd' AND user_id='$user_id'
";
mysqli_query($conn,$del);
}
if($post_id){
$sql="INSERT INTO poll (values,post_id,user_id,timestamp)
VALUES ('$post_id','$postd','$user_id','$timestamp')
";
}else{
$sql="INSERT INTO poll (values,post_id,user_id,timestamp)
VALUES ('$post_id1','$postd','$user_id','$timestamp')
";
}
mysqli_query($conn,$sql);
if($user_id==$follow_userid){
}else{
$not="INSERT INTO notifications(post_id,user_id,user2, timestamp,content,type,content_id)
VALUES ('$postd','$user_id','$follow_userid','$timestap','$content','$type','$comid')
";
mysqli_query($conn,$not);
}
if($post_id){
$up="UPDATE posts
SET value1a = value1a + 1
WHERE id='$postd'
"
;
}
if($post_id1){
$up="UPDATE posts
SET value2a = value2a + 1
WHERE id='$postd'
"
;
}
mysqli_query($conn,$up);
//Check If The PERSON WHO IS UPVOTING HAS ALREADY DOWNVOTED
$qe = "SELECT id
FROM poll
WHERE post_id='$postd' AND user_id='$user_id'
";
$query23= mysqli_query($conn,$qe);
mysqli_close($conn);
if($ref ==13)
{
header ("location: comment.php?post=$postd&comment=$comid ");
}else{
header ("location: post.php?pid=$postd ");
}
}else{
if($ref==13)
{
header ("location: post.php?post=$postd&comment=$comid ");
}else{
header ("location: post.php?pid=$postd ");
}
}
?><?php ob_end_flush();?>