-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_post_review.php
406 lines (214 loc) · 15.7 KB
/
user_post_review.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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<?php
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
error_reporting(E_ALL);
ini_set('display_errors', 1);
$servername = "localhost";
$username = "vhost85252s0";
$password = "0jKJd,x8Xs";
$dbname = "vhost85252s0";
// Create connection
$link = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if ($link->connect_error) {
die("Connection failed: " . $link->connect_error);
}
$gameID = $_GET['id'];
?>
<div class="clearfix"></div>
<div class="row comment_system sep_section" id="comment">
<div class="media">
<?php
$actionPath = SITEURL."game_update/game_comment.php";
$currentUserID = USERID;
if($result = mysqli_query($link, "SELECT * FROM e107_game_comment where commentUserID =".$currentUserID." AND postID=".$gameID)){
$userCommentPost = mysqli_num_rows($result);
}
if(USERID != 0 && $userCommentPost < 1){
?>
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>
<script type="text/javascript">
//<![CDATA[
bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
//]]>
</script>
<h3>Writer your review: </h3>
<form id="comments_form" method="post" action="<?php echo $actionPath; ?>">
<div class="media comment-box comment-box-form clearfix">
<div class="comment-box-left media-object pull-left">
<!-- <div class="comment-avatar center"><img class="img-rounded rounded user-avatar" alt="" src="/wp/game_e107/thumb.php?src=%7Be_IMAGE%7Dgeneric%2Fblank_avatar.jpg&w=90&h=90" width="90" height="90"><div class="field-help" style="display:none;"><div class="left"><h2></h2><br>Guest<br><br></div></div></div> -->
</div>
<div class="media-body comment-box-right text-left">
<div class="P10">
<div class="form-group">
<label>Title: </label> <input type="text" class="commentTitle" name="commentTitle">
<input type="hidden" class="commentTitle" name="hostname" value="<?php echo $hostname; ?>">
<input type="hidden" class="commentTitle" name="username" value="<?php echo $username; ?>">
<input type="hidden" class="commentTitle" name="password" value="<?php echo $password; ?>">
<input type="hidden" class="commentTitle" name="database" value="<?php echo $database; ?>">
</div>
<div class="form-group">
<?php
if($currentUserID != 0 && $userCommentPost < 1){
?>
<div class="rating_system">
<div class="rating_label">Rating: </div>
<select name="user_rating">
<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>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</div>
<?php
}
else {
?>
<select name="user_rating" style="display: none;"><option value="0">0</option></select>
<?php
}//end if $currentUserID != 0 && $userCommentPost < 1
?>
</div>
<div class="form-group">
<div class="platform_label"><strong>What platform they played the game that you review?: </strong></div>
<div class="platform_select">
<?php
if($result_cat = mysqli_query($link, "SELECT * FROM e107_games where id = ".$gameID)){
if(mysqli_num_rows($result_cat) > 0){
while($row_cat = mysqli_fetch_array($result_cat)){
$platform_array[] = $row_cat["platformSelected"];
}//end while $row_cat
}//end if mysqli_num_rows
}//end if $result_cat
if($platform_array != ""){
$platform_array = explode(",", $platform_array[0]);
?>
<select name="commentPlatform">
<option>Select Platform</option>>
<?php
foreach($platform_array as $platform_val){
?>
<option value="<?php echo $$platform_val; ?>"><?php echo $platform_val; ?></option>
<?php
}//end foreach $platform_array
?>
</select>
<?php
}//end if $platform_array
?>
</div>
</div>
<input type="hidden" name="commentUserID" value="<?php echo USERID; ?>">
<div class="form-group"><textarea name="comment_value" rows="10" cols="80" id="comment-input-news" class="comment-input form-control e-autoheight" placeholder="Leave a message..."></textarea></div>
<div id="commentformbutton">
<input type="submit" name="commentsubmit" value="Submit comment" class="commentSubmit button btn btn-primary pull-right" data-pid="0" data-sort="desc" data-target="/wp/game_e107/comment.php" data-container="comments-container-news" data-input="comment-input-news">
<?php
$currentUserID = USERID;
if($result = mysqli_query($link, "SELECT * FROM e107_game_comment where commentUserID =".$currentUserID." AND postID=".$gameID)){
$userCommentPost = mysqli_num_rows($result);
}//end if $result
?>
</div>
</div>
</div>
</div>
<div class="clear_b"><!-- --></div>
<hr>
<div>
<?php
$postID = $gameID;
$userImage = SITEURL."e107_plugins/games/images/blank_avatar.jpg";
$uri = $_SERVER['REQUEST_URI'];
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$currentPage = $url;
?>
<input type="hidden" name="postID" value="<?php echo $postID; ?>">
<input type="hidden" name="userImage" value="<?php echo $userImage; ?>">
<input type="hidden" name="currentPage" value="<?php echo $currentPage; ?>">
<?php
$currentDate = date("d-m-Y");
?>
<input type="hidden" name="currentDate" value="<?php echo $currentDate; ?>">
</div>
</div>
</div>
</form>
<?php
}
else {
$loginURL = SITEURL."/login.php";
echo '<h3>You already have Reviewed this game.</h3>';
}//end if USERID != 0 && $userCommentPost < 1
?>
</div>
<ul class="comments-container-news" style="display: none;">
<?php
$actionPath_delete = SITEURL."game_update/game_comment_delete.php";
if($result = mysqli_query($link, "SELECT * FROM e107_game_comment where postID=".$gameID)){
if(mysqli_num_rows($result) > 0){
$commentLoop = 0;
while($row = mysqli_fetch_array($result)){
$commentLoop++;
$postComment = $row["postComment"];
$commentID = $row["commentID"];
$commentDate = $row["commentDate"];
$commentUserID = $row["commentUserID"];
$commentRating = $row["commentRating"];
?>
<li id="comment-<?php echo $commentLoop; ?>" class="media comment-box clearfix">
<div class="media-object comment-box-left pull-left span1">
<div class="comment-avatar center">
<img class="img-rounded rounded user-avatar user-avatar-online" alt="" src="<?php echo $userImage; ?>" width="90" height="90">
</div>
</div>
<div class="media-body comment-box-right ">
<div class="row">
<div class="comment-box-username span2 col-xs-6 col-sm-6 col-md-6">
<a href="/wp/game_e107/user.php?id.1">admin</a>
</div>
<div class="comment-box-date span2 col-xs-6 col-sm-6 col-md-6 text-right text-muted">
<div><?php echo $commentDate; ?></div>
<?php
if($commentRating != "0"){
?>
<div>Rating: <?php echo $commentRating; ?></div>
<?php
}
?>
</div>
</div>
<div class="row-fluid">
<div class="span12 col-xs-12 comment-text" id="comment-5-edit" contenteditable="false">
<p><?php echo $postComment; ?></p>
</div>
</div>
<?php
if($commentUserID == $currentUserID && $currentUserID != 0){
?>
<div class="row">
<div class="comment-status span2 col-sm-12 col-md-6"></div>
<div class="comment-moderate span6 col-sm-12 col-md-6 text-right">
<span class="comment-moderate">
<form id="" method="post" class="commentDelete" action="<?php echo $actionPath_delete; ?>" >
<input type="hidden" name="commentID" value="<?php echo $commentID; ?>">
<input type="hidden" name="currentPage" value="<?php echo $currentPage; ?>">
<input type="submit" name="" value="Delete" class="comment_deleteButton">
</form>
</span>
</div>
</div>
<?php
}
?>
</li>
<?php
}//end while row
}//end if mysqli_num_rows
}//end if $result
?>