-
Notifications
You must be signed in to change notification settings - Fork 0
/
guest.php
552 lines (400 loc) · 17.6 KB
/
guest.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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
<?php
session_start();
$_SESSION['usertype']="guest";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Guest</title>
<link rel="stylesheet" href="./css/bootstrap.min.css">
<!--font-awesome-->
<script src="./js/all.js"></script>
<!-- main css-->
<style>
.header {
background: url("images/GIKI2.jpg");
background-size: cover;
background-position:fixed;
background-repeat: no-repeat;
}
.nav-link {
font-size: 1.5rem;
transition: font-size 0.5s ease-out;
}
.nav-link:hover {
font-size: 1.8rem;
}
body {
/* font-family: 'Raleway', sans-serif; */
font-family: 'Lato', sans-serif;
/* font-family: 'Ubuntu', sans-serif; */
margin-bottom: 5px;
}
.card p{
margin:0px;
}
.card-header h3 a {
color: #235daa;
transition: color 0.5s ease-in-out, font-size 0.5s ease-in-out , font-weight 0.5s ease-in-out;
}
.card-header h3 a:hover {
color: #0a2a55;
font-weight: bold;
font-size: 3vw;
}
#thumbsup{
font-size:3vw;
}
.nohover {
pointer-events: none;
}
#thumbsup:hover{
cursor: pointer;
-webkit-animation: myanimation 4s;
}
</style>
<!-- google fonts-->
<link href="https://fonts.googleapis.com/css?family=Karla" rel="stylesheet">
</head>
<body>
<script>
var count = 4;
function load() {
var flag=0;
count = count + 2;
$.ajax({
url: 'load.php',
type: 'POST',
data: {
count,flag
},
success: function(result) {
$('#threads').html(result);
var type = '<?php echo $_SESSION["usertype"]; ?>';
if(type!="admin" && type!="moderator")
{
var elems =document.getElementsByClassName("delete");
for (var i=0;i<elems.length;i+=1){
elems[i].style.display = 'none';
}
}
}
});
}
</script>
<div class="container-fluid" style="margin-bottom: 0">
<!-- header -->
<div class="row header pb-3 pt-4">
<div class="col">
<h1 class="display-3 font-weight-bold">GIK <span style="color:#062b5c;font-weight: lighter">Forum</span>
</h1>
</div>
</div>
<!-- end header -->
</div>
<!-- Main Menu Navigation(Home,Contact Us,Account,Search Box) -->
<nav class="navbar navbar-expand-lg navbar-light" style="background:#0f3f7e">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link text-white" href="guest.php"><i class="fa fa-home mr-2"></i>Home <span
class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="contact.php">Contact Us</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" href="aboutus.php">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link text-danger" href="index.php">Login/Sign Up</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" onkeyup="sea(this.value)" aria-label="Search">
</form>
</div>
</nav>
<!-- End of Main Menu -->
<script>
function des()
{
var a = 1;
$.ajax({
url: "post.php",
type: "POST",
data: {a},
success: function(result)
{
}
});
}
</script>
<script>
function sea(input)
{
$.ajax({
url: "search.php",
type: "POST",
data: {input},
success: function(result){
$("#threads").html(result);
var type = '<?php echo $_SESSION["usertype"]; ?>';
if(type!="admin" && type!="moderator")
{
var elems =document.getElementsByClassName("delete");
for (var i=0;i<elems.length;i+=1){
elems[i].style.display = 'none';
}
}
}
});
}
</script>
<!-- <script>
var flag1 = 0;
function likedthreads(){
flag1 = 1;
$.ajax({
url:'likedthreads.php',
type:'POST',
success: function(result){
$("#threads").html(result);
/* if(type!="admin" && type!="moderator")
{
var elems =document.getElementsByClassName("delete");
for (var i=0;i<elems.length;i+=1){
elems[i].style.display = 'none';
}
}*/
}
});
}
</script> -->
<!-- Create a Thread Button -->
<!--end of modal-->
<!--PHP SCRIPT-->
<!--PHP SCRIPT END-->
<!-- Sort By Navigation Bar -->
<div class="" style="width: 35vw;height:3.3vw;border-top-right-radius: 8px;border-bottom-right-radius: 8px;margin-top:20px; background:#0a2a55">
<div class="row">
<div class="mt-1 ml-sm-1 ml-md-1 mr-md-1 ml-xs-1 col-sm-3 col-md-3 col-xs-1 text-light" style="font-size:1.8vw; width:10vw;padding-right:0;">
Sort By
</div>
<div class="col-sm-4 col-md-4 col-xs-4 ml-sm-1 ml-md-2 mr-md-1 mr-sm-1 my-0 " style="width:15vw;padding-right:0;">
<a class="nav-link text-danger px-0 py-0" style="font-size:1.5vw" href="#" onclick="hotsort()"><i class="fa fa-fire"></i> Hot Threads</a>
</div>
<div class="col-sm-4 col-md-4 col-xs-4 ml-md-0 my-0 px-0 py-0 ml-sm-0" style="width:15vw">
<a class="nav-link text-success px-0 py-0" style="font-size:1.5vw" href="#" onclick = "likedthreads()"><i class="fa fa-thumbs-up"></i> Liked Thread</a>
</div>
</div>
</div>
<!-- End Of Sort By Navigation Bar -->
<!-- Script for hot sort -->
<!-- Script End for hot sort -->
<!-- Main Container Starts Here -->
<div class="container-fluid">
<div class="row d-flex justify-content-between">
<!-- Threads Section Starts Here -->
<div class="col-8 mt-2 md-8 sm-5 xs-5">
<div id="threads">
<?php
include "connection.php";
$sql = "select title, post_count, report_count, thread_id,up_votes,down_votes,category from thread where status=0 ORDER BY created_time DESC LIMIT 4";
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
while ($rows = mysqli_fetch_assoc($result)) {
$sql1 = 'SELECT subject FROM category WHERE cat_id = ' . $rows["category"] . ';';
$result1 = mysqli_query($con, $sql1);
$rows1 = mysqli_fetch_assoc($result1);
echo '<div class="card bg-light mt-2"
style=" box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); border:none;">
<div class="card-header pb-0 px-1">
<h3 class="text-capitalize" style=" font-size:2.5vw"><a href="guestthread.php?title=' . $rows["title"] . '&id=' . $rows["thread_id"] . '" style="text-decoration: none;">' . $rows["title"] . '</a></h3>
</div>
<div class="card-body px-1 py-0" >
<span class = "text-danger ml-1" style = "font-style:italic;display:block;font-size:1.2vw">Category: ' . $rows1["subject"] . '</span>
</div>
<div class="card-footer bg-secondary" style="border:none;padding:0">
<p class="m-0">
<div class="d-flex justify-content-between py-1 px-1">
<div class="">
<i id = "thumbsup" class="fas fa-arrow-up fa-2x text-success" onclick="upvote('.$rows["thread_id"].'0);" style="font-size:2vw;"></i>
<h3 id="'.$rows["thread_id"].'0" class="text-white ml-1" style="display:inline;font-size:2vw;;margin-bottom:0;">'.$rows["up_votes"].'</h3>
<i id = "thumbsup" class="fas fas fa-arrow-down fa-2x text-danger ml-4" onclick="downvote('.$rows["thread_id"].'1);" style="font-size:2vw;"></i>
<h3 id="'.$rows["thread_id"].'1" class="text-white ml-1" style="display:inline;font-size:2vw;">' . $rows["down_votes"] . '</h3>
</div>
<div class="">
<i class="fa fa-list-ol fa-2x text-info" style="font-size:2vw;"></i>
<h3 class="text-white ml-1 " style="display:inline;font-size:2vw;">' . $rows["post_count"] . '</h3>
</div>
</div>
</p>
</div>
</div>';
}
} else {
echo "<h2 class='text-center mt-5' style='font-size:5vw'>NO THREADS!</p>";
}
/* <div class="card bg-light"
style=" box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); border:none; ">
<div class="card-body">
<h3><a href="#" style="text-decoration: none;font-size:3.5vw;">THREAD 1</a></h3>
</div>
<div class="card-footer bg-secondary py-0 px-2" style="border:none;">
<div class="d-flex justify-content-between">
<div class="">
<i class="fa fa-eye" style="font-size: 3vw"></i>
<h3 class="text-white ml-0" style="display:inline;font-size:3vw">100</h3>
</div>
<div class="">
<i class="fas fa-exclamation-triangle ml-2 text-warning" style="font-size: 3vw"></i>
<h3 class="text-white ml-0" style="display:inline;font-size:3vw">10</h3>
</div>
<div class="">
<i class="fa fa-list-ol ml-2 text-info" style="font-size: 3vw"></i>
<h3 class="text-white ml-0 " style="display:inline;font-size:3vw">10</h3>
</div>
</div>
</div>
</div>*/
?>
<!--upvote ajax-->
<!-- upvote ajax end -->
<!-- TYPE DISCRIMINATION DELETE BUTTON HIDE-->
<!-- TYPE DISCRIMINATION DELETE BUTTON HIDE END-->
<!--ajax for delete button click-->
<!-- ajax for delete button click end-->
<!--categories script-->
<script>
function categories(catid)
{
flag =22;
$.ajax({
url: "categories.php",
type: "POST",
data: {catid},
success: function(result){
$('#threads').html(result);
var type = '<?php echo $_SESSION["usertype"]; ?>';
if(type!="admin" && type!="moderator")
{
var elems =document.getElementsByClassName("delete");
for (var i=0;i<elems.length;i+=1){
elems[i].style.display = 'none';
}
}
}
});
}
</script>
<!-- end categories script-->
</div>
<button class="btn btn-danger btn-block btn-sm mt-2" onclick="load()"
style="padding:0;"><span style="font-size:2vw">LOAD MORE</span></button>
<!--SCRIPT FOR BUTTON-->
<!-- <script>
var count = 4;
function load() {
count = count + 2;
$.ajax({
url: 'guestload.php',
type: 'POST',
data: {
count,flag
},
success: function(result) {
$('#threads').html(result);
var type = '<?php echo $_SESSION["usertype"]; ?>';
if(type!="admin" && type!="moderator")
{
var elems =document.getElementsByClassName("delete");
for (var i=0;i<elems.length;i+=1){
elems[i].style.display = 'none';
}
}
}
});
}
</script> -->
<!--script ends for button-->
</div>
<!-- Threads Section Ends Here -->
<div class="col-4 mt-4 md-4 sm-7 xs-7">
<!-- Announcements Section Starts Here -->
<div class="row">
<div class="col">
<div class="card" style="background:#0f3f7e; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); border:none;">
<div class="card-body px-1 py-1">
<h3 class="text-light text-center" style="font-size:2.5vw;">Announcements</h3>
<ul class="list-group">
<?php
include "connection.php";
$sql = "select content from announcement order by time DESC;";
$result = mysqli_query($con, $sql);
if (mysqli_num_rows($result) > 0) {
while ($rows = mysqli_fetch_assoc($result)) {
echo ' <li class="list-group-item list-group-item-light text-center text-danger font-weight-bold nohover px-1 py-2" style="font-size:1.2vw;">
' . $rows["content"] . '
</li>';
}
}
?>
</ul>
</div>
<div class="card-footer bg-secondary" style="padding-bottom:2vw;padding-top:0;">
</div>
</div>
</div>
<!-- Announcements Section Ends Here -->
</div>
<!-- Categories Section Starts Here -->
<div class="row mt-2">
<div class="col">
<div class="card" style="background:#0f3f7e; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); border:none;">
<div class="card-body px-1 py-1">
<h3 class="text-light text-center" style="font-size:2.5vw;">Categories</h3>
<ul class="list-group">
<?php
include "connection.php";
$sql = "select * from category";
$result = mysqli_query($con,$sql);
if(mysqli_num_rows($result)>0)
{
while($rows = mysqli_fetch_assoc($result))
{
echo ' <li id="'.$rows["cat_id"].'" class="list-group-item cats text-center" onclick="categories(this.id)" style="padding-top:0.5vw;padding-bottom:1vw;"><a href="#" style="text-decoration: none;font-size:1.8vw;">'.$rows["subject"].'</a></li>';
}
}
?>
</ul>
</div>
<div class="card-footer bg-secondary" style="padding-bottom:2vw;padding-top:0;">
</div>
</div>
</div>
</div>
<!-- Categories Section Ends Here -->
</div>
</div>
<!-- Footer Starts Here -->
<footer style="font-size:1.5vw;position:absolute;text-align:center;width:96%;padding-top:10vw;margin-bottom:5px">
© 2019 Copyright:
Netronix
</footer>
<!-- Footer Ends Here -->
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- jquery -->
<script src="./js/jquery-3.3.1.min.js"></script>
<!-- bootstrap js-->
<script src="./js/bootstrap.bundle.min.js"></script>
</body>
</html>