-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreview2.php
43 lines (42 loc) · 1 KB
/
review2.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
<?php
session_start();
if (!isset($_SESSION['username']))
{
header('location:login.php');
}
$con = mysqli_connect('localhost', 'root', '');
mysqli_select_db($con, 'gameplanet');
$name = $_SESSION['username'];
$id = $_POST['gameid'];
$vote = $_POST['likeordislike'];
$s = " select * from review where username = '$name' and gid = '$id'";
$result = mysqli_query($con, $s);
$num = mysqli_num_rows($result);
if ($num == 1)
{
echo "<h3> You have already Voted for this Game !</h3>";
}
else
{
if ($vote == "upvote")
{
$reg = " insert into review (username, gid, upvote, downvote) values ('$name', '$id', 1, 0) ";
}
else
{
$reg = " insert into review (username, gid, upvote, downvote) values ('$name', '$id', 0, 1) ";
}
mysqli_query($con, $reg);
header('location:review3.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Review Confirmation Page</title>
<link rel="stylesheet" type="text/css" href="style6.css">
</head>
<body>
</body>
</html>