-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrating.php
More file actions
215 lines (138 loc) · 5.14 KB
/
rating.php
File metadata and controls
215 lines (138 loc) · 5.14 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
// Initialize the session
session_start();
// If session variable is not set it will redirect to login page
if(!isset($_SESSION['username']) || empty($_SESSION['username'])){
header("location: login.php");
exit;
$con=mysqli_connect("localhost","root","","honestcraig_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// Perform queries
$user= $_SESSION['username'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Popped</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="stylesheet.css" type="text/css" rel="stylesheet">
</head>
<body style="background-color: #990000">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
<div class="container">
<a class="navbar-brand" href="#"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item ">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="account.php">Account</a>
</li>
<li class="nav-item">
<a class="nav-link" href="sell.php">Sell</a>
</li>
</ul>
</div>
</div>
</nav>
<br>
<div class="row" style="background-color: #990000">
<br>
<div class="col-4"></div>
<div class="col-4"style="background-color: #b9bec1">
<h1>Purchase successful!</h1>
</div>
<div class="col-4"></div>
</div>
<br>
<!-- Page Content -->
<div class="container">
<div class="row" style= "background-color: #b9bec1">
<div class="col">
<?php
//Start removal of listing//
$category = $_SESSION['category'];
$product = $_SESSION['product'];
$price = $_SESSION['price'];
$seller = $_SESSION['seller'] ;
$con=mysqli_connect("localhost","root","","honestcraig_db");
$sql = "DELETE FROM listings WHERE product_category = '$category' AND product = '$product' AND product_price = '$price' AND username = '$seller';";
mysqli_query($con,$sql);
?>
<!-- Debug
<br>
Username: <?php echo htmlspecialchars($_SESSION['username']); ?>
<br>
Category: <?php echo $category?>
<br>
Product: <?php echo $product?>
<br>
Price: <?php echo $price?>
<br>
Seller: <?php echo $seller?>
<br>
-->
<h3 align="center">Please take a second and leave a review of your purchase from <?php echo htmlspecialchars($_SESSION['username']); ?></h3>
<form action="review_confirmation.php" method="post">
<h3>Rating:
<select name="userRating">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<h3>Comment:</h3>
<textarea name="userComment" rows="5" cols="50"></textarea>
<br>
<center><button type="submit" class="btn btn-success">Submit</button></center>
<br>
</form>
</div>
</div>
</div>
</footer>
<nav class="navbar navbar-dark bg-dark fixed-bottom">
<?php if( isset($_SESSION['username']) && !empty($_SESSION['username']) )
{
?>
<div class="container text-center">
<p class="navbar-text col-md-12 col-sm-12 col-xs-12 text-white">Copyrighted by HonestCraig<sup>©</sup>
<br>
Logged in as: <?php echo htmlspecialchars($_SESSION['username']); ?>
<br>
<a href="logout.php" class="btn btn-danger">Sign Out</a>
</p>
</div>
<?php }else{ ?>
<div class="container text-center">
<p class="navbar-text col-md-12 col-sm-12 col-xs-12 text-white">
Copyrighted by HonestCraig<sup>©
<br>
<br>
<a href="login.php" class="btn btn-success">Sign in</a>
</p>
</div>
<?php } ?>>
</nav>
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
</body>
</html>