-
Notifications
You must be signed in to change notification settings - Fork 0
/
guestthread.php
382 lines (281 loc) · 12.7 KB
/
guestthread.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
<?php
session_start();
include "connection.php";
?>
<!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>Start</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;
}
body {
/* font-family: 'Raleway', sans-serif; */
font-family: 'Lato', sans-serif;
/* font-family: 'Ubuntu', sans-serif; */
margin-bottom: 5px;
}
.card-body h3 a {
color: #235daa;
transition: color 0.3s, font-size 0.3s, font-weight 0.3s;
}
.card-body h3 a:hover {
color: #0a2a55;
font-weight: bold;
font-size: 30px;
}
.nohover {
pointer-events: none;
}
.centered {
float: none;
margin: 0 auto;
}
.nav-link {
font-size: 1.5rem;
transition: font-size 0.5s ease-out;
}
.nav-link:hover {
font-size: 1.8rem;
}
</style>
<!-- google fonts-->
<link href="https://fonts.googleapis.com/css?family=Karla" rel="stylesheet">
</head>
<body>
<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 dropdown">
<a class="nav-link dropdown-toggle text-white" href="#" id="navbarDropdown" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Account
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item " href="account.php">Settings</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" onclick="des()" href="index.php">Sign Out</a>
</div>
</li> -->
</ul>
<!-- <form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-light my-2 my-sm-0" type="submit">Search</button>
</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>
<div class="container-fluid">
<!-- Main Container Starts Here -->
<div class="container-fluid">
<div class="row d-flex justify-content-between">
<!-- Threads Section Starts Here -->
<div class="col">
<div class="jumbotron jumbotron-fluid mx-1 p-0 ">
<div class="container">
<h1 class="text-center text-capitalize" style = "font-size:4vw"><?php echo $_GET["title"]; ?></h1>
</div>
</div>
</div>
<!-- Threads Section Ends Here -->
</div>
<div class="row">
<div class="col" id="posts">
<?php
$tit = $_GET["title"];
$id = $_GET["id"];
$_SESSION["id"] = $id;
$sql = "select posted_by, posted_on, post_id, content from post where thread_id = $id and status = 0 order by posted_on ASC;";
$result = mysqli_query($con, $sql);
while ($rows = mysqli_fetch_assoc($result)) {
$ID = $rows["post_id"];
$nname = $rows["posted_by"];
$time = $rows["posted_on"];
$content = $rows["content"];
$sql1 = "select type from user where username = '$nname';";
$result1 = mysqli_query($con, $sql1);
$rows1 = mysqli_fetch_assoc($result1);
$usertype = $rows1["type"];
if($usertype == "normal")
{
echo ' <section>
<div class="container py-3">
<div class="card shadow-lg" style="border:none;border-radius:0">
<div class="row ">
<div class="col-lg-2 bg-dark text-white col-md-2 col-sm-3 col-xs-4 p-lg-0 p-md-0 p-sm-0" style="width:16vw;border-right:1px solid grey">
<i class="fa fa-user fa ml-lg-5 ml-md-5 ml-sm-5 mt-4" style="font-size:7vw"></i>
<p class="ml-md-4 ml-lg-1 ml-sm-1 text-capitalize text-center"id="poster-name" style="font-size:1.5vw">' . $nname . ' <br>' . $time . '</p>
<!-- <div class="delete">
<i class="fas fa-times fa-2x text-danger" onclick="dltpost('.$ID.','.$id.')" style="font-size:2.8vw;"></i>
</div> -->
</div>
<div class="col-lg-10 col-md-10 col-sm-9 col-xs-8 px-4" style="width:60vw">
<div class="card-block px-3">
<p class="lead" style="font-size:1.8vw"> ' . $content . ' </p>
</div>
</div>
</div>
</div>
</div>
</section>';
}
else{
echo ' <section>
<div class="container py-3">
<div class="card shadow-lg" style="border:none;border-radius:0">
<div class="row ">
<div class="col-lg-2 bg-dark text-white col-md-2 col-sm-3 col-xs-4 bg-light p-lg-0 p-md-0 p-sm-0" style="width:16vw;border-right:1px solid grey">
<i class="fa fa-user fa ml-lg-5 ml-md-5 ml-sm-5 mt-4" style="font-size:7vw"></i>
<p class="ml-md-4 ml-lg-0 ml-sm-1 text-capitalize text-center"id="poster-name" style="font-size:1.5vw"><span class = "text-primary text-uppercase">'.$usertype.'</span><br>'.$nname . ' <br>' . $time . '</p>
<!-- <div class="delete">
<i class="fas fa-times fa-2x text-danger" onclick="dltpost('.$ID.','.$id.')" style="font-size:2.8vw;"></i>
</div> -->
</div>
<div class="bg-white text-danger col-lg-10 col-md-10 col-sm-9 col-xs-8 px-4" style="width:60vw">
<div class="card-block px-3">
<p class="lead" style="font-size:1.8vw"> ' . $content . ' </p>
</div>
</div>
</div>
</div>
</div>
</section>';
}
}
//ALSO REVERT CHANGES IF NOT WORK ACTION=POST.PHP ad remove php script
?>
<!-- TYPE DISCRIMINATION DELETE BUTTON HIDE-->
<!-- TYPE DISCRIMINATION DELETE BUTTON HIDE END-->
<!--delete post script here-->
<!-- delete post script ends here-->
<!--THIS IS POST FORM-->
<!-- <div class="row d-flex">
<div class="col-6 centered">
<form action="thread.php<?php echo '?title=' . $tit . '&id=' . $id; ?>" method="POST">
<div class="form-group">
<label for="comment" style="font-size:4.5vw">Reply</label>
<textarea class="form-control" rows="5" id="comment" name="post-area" required></textarea>
</div>
<button class="btn btn-success btn-block px-0 py-0" onclick="load()" type="submit"><span style = "font-size:2.5vw">POST</span> <i class="fas fa-paper-plane" style = "font-size:2.5vw"></i> </button>
</form> -->
<!-- <script>
function load() {
var tent = $("#comment").val();
if(tent == ""){
window.alert("Please enter something.");
return;
}
$.ajax({
url: 'loadpost.php',
type: 'POST',
data: {
tent
},
success: function(result) {
$('#posts').html(result);
}
});
}
</script> -->
</div>
</div>
</div>
</div>
</div>
<!--start of php script for reply post-->
<?php
/*
include "connection.php";
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$name = $_SESSION["user_name"];
$content = $_POST["post-area"];
$id = $_SESSION["id"];
include "connection.php";
$content = $_POST["post-area"];
$sql = "INSERT INTO post(thread_id,posted_on,posted_by,content,status,report_count) VALUES($id,now(),'$name','$content',0,0);";
mysqli_query($con,$sql);
$sql = "select post_count from thread where thread_id=$id AND status = 0;";
$result = mysqli_query($con,$sql);
if(mysqli_num_rows($result)>0)
{
while($rows= mysqli_fetch_assoc($result))
{
$count = $rows["post_count"];
}
}
$count=$count +1;
$sql= "update thread set post_count = $count where thread_id= $id";
mysqli_query($con,$sql);
//USER KA POST COUNT BHI PLUS KARNA HAI
}
*/
?>
<!--end of post script-->
<!--this is ed of post-->
</div>
</div>
</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:
Riaz-ul-Haq | Uzair Ahmed
| Muhammad Inam | Gulfam Hussain
</footer>
<!-- Footer Ends Here -->
</div>
</div>
<!-- jquery -->
<script src="./js/jquery-3.3.1.min.js"></script>
<!-- bootstrap js-->
<script src="./js/bootstrap.bundle.min.js"></script>
</body>
</html>