-
Notifications
You must be signed in to change notification settings - Fork 1
/
program_details.php
329 lines (266 loc) · 12.8 KB
/
program_details.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
<?php
session_start();
include('includes/config.php');
//Genrating CSRF Token
if (empty($_SESSION['token'])) {
$_SESSION['token'] = bin2hex(random_bytes(32));
}
if(isset($_POST['submit']))
{
//Verifying CSRF Token
if (!empty($_POST['csrftoken'])) {
if (hash_equals($_SESSION['token'], $_POST['csrftoken'])) {
$name=$_POST['name'];
$email=$_POST['email'];
$comment=$_POST['comment'];
$postid=intval($_GET['nid']);
$st1='0';
$query=mysqli_query($con,"insert into tblcomments(postId,name,email,comment,status) values('$postid','$name','$email','$comment','$st1')");
if($query):
echo "<script>alert('comment successfully submit. Comment will be display after admin review ');</script>";
unset($_SESSION['token']);
else :
echo "<script>alert('Something went wrong. Please try again.');</script>";
endif;
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous" />
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" />
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/footer.css">
<title>Tech-Wolrd</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark navbar fixed-top p-md-1">
<div class="container">
<!-- mb-0 h1 -->
<a class="navbar-brand " href="index.html">
<img src="image/brand-logo.png" width="120" height="30" alt="" loading="lazy"></a>
<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 ">
<!-- <ul class="nav justify-content-end"> -->
<li class="nav-item active">
<a class="nav-link" href="index.html">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="freeCourse.php">Free Courses</a>
</li>
</li>
<li class="nav-item">
<a class="nav-link" href="programminghub.php">Programming Hub</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Ebook.php">E-Books</a>
</li>
</li>
</ul>
</div>
</div>
</nav>
<!-- Banner image start -->
<div id="carouselExampleCaptions" class="carousel slide carousel-fade" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<img src="image/Program-slider2.png" class="d-block w-100" alt="...">
</div>
</div>
<!-- Banner image end -->
<!-- Blog Entries Column Start-->
<div class="container">
<div class="row" style="margin-top: 4%">
<!-- Blog Entries Column -->
<div class="col-md-8">
<!-- Blog Post -->
<?php
$pid=intval($_GET['nid']);
$query=mysqli_query($con,"select programpost.id as pid, programpost.PostTitle as posttitle,programpost.PostDetails as postdetails,programpost.FileName as filename, programcategory.CategoryName as category,programcategory.id as cid from programpost left join programcategory on programcategory.id=programpost.CategoryId where programpost.id='$pid' ");
while ($row=mysqli_fetch_array($query)) {
?>
<div class="card mb-4">
<div class="card-body">
<h2 class="card-title" style="font-size: 20px;">
<?php echo htmlentities($row['posttitle']);?></h2>
<p><b>Category : </b> <a
href="program_category.php?catid=<?php echo htmlentities($row['cid'])?>"><?php echo htmlentities($row['category']);?></a>
|
</p>
<hr />
<p class="card-text"><?php $pt=$row['postdetails']; echo (substr($pt,0));?></p>
<!-- <a href="program_download.php?nid=<?php echo htmlentities($row['filename'])?>"
target="black" class="btn btn-outline-success" role="button"
aria-pressed="true">Download</a> -->
<a href="program_download.php?file_name=<?php echo htmlentities($row['pid'])?>"
class="btn btn-outline-success" role="button" aria-pressed="true">Download</a>
</div>
<div class="card-footer text-muted">
</div>
</div>
<?php } ?>
<div>
<a href="programminghub.php" class="btn btn-outline-danger btn-sm" role="button"
aria-pressed="true">Back</a>
</div>
</div>
<!-- Blog Entries Column end-->
<!-- sidebar start -->
<div class="col-md-4">
<!-- Search Widget -->
<div class="card mb-4 demo">
<h5 class="card-header">Search</h5>
<div class="card-body">
<form name="search" action="program_search.php" method="post">
<div class="input-group">
<input type="text" name="searchtitle" class="form-control"
placeholder="Search for..." required>
<span class="input-group-btn">
<button class="btn btn-secondary" type="submit">Go!</button>
</span>
</form>
</div>
</div>
</div>
<!-- Categories Widget -->
<div class="card my-4">
<h5 class="card-header">Categories</h5>
<div class="card-body">
<ul class="mb-0">
<?php $query=mysqli_query($con,"select id,CategoryName from programcategory");
while($row=mysqli_fetch_array($query))
{
?>
<li>
<a
href="program_category.php?catid=<?php echo htmlentities($row['id'])?>"><?php echo htmlentities($row['CategoryName']);?></a>
</li>
<?php } ?>
</ul>
</div>
</div>
<!-- sidebar end -->
</div>
</div>
<!-- Card layout end -->
<!-- Back to top button start-->
<button type="button" class="btn btn-danger btn-floating btn-lg" id="btn-back-to-top">
<i class="fas fa-arrow-up"></i>
</button>
<!-- Back to top button end-->
<!---Comment Section start--->
<br><br><br><br><br>
<div class="row" style="margin-top: -8%">
<div class="col-md-8">
<div class="card my-4">
<h5 class="card-header">Leave a Comment:</h5>
<div class="card-body">
<form name="Comment" method="post">
<input type="hidden" name="csrftoken"
value="<?php echo htmlentities($_SESSION['token']); ?>" />
<div class="form-group">
<input type="text" name="name" class="form-control" placeholder="Enter your fullname"
required>
</div>
<div class="form-group">
<input type="email" name="email" class="form-control"
placeholder="Enter your Valid email" required>
</div>
<div class="form-group">
<textarea class="form-control" name="comment" rows="3" placeholder="Comment"
required></textarea>
</div>
<button type="submit" class="btn btn-primary" name="submit">Submit</button>
</form>
</div>
</div>
<!---Comment Display Section --->
<?php
$sts=1;
$query=mysqli_query($con,"select name,comment,postingDate from tblcomments where postId='$pid' and status='$sts'");
while ($row=mysqli_fetch_array($query)) {
?>
<div class="media mb-4">
<img class="d-flex mr-3 rounded-circle" src="image/usericon.png" alt="">
<div class="media-body">
<h5 class="mt-0">
<?php echo htmlentities($row['name']);?> <br />
<span style="font-size:11px;"><b>at</b>
<?php echo htmlentities($row['postingDate']);?>
</span>
</h5>
<?php echo htmlentities($row['comment']);?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!---Comment Section end--->
<!-- footer start -->
<div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col">
<h4>Tech-World</h4>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#">our services</a></li>
</ul>
</div>
<div class="footer-col">
<h4>Our Project Guide</h4>
<ul>
<li><a href="#">Mr Niraj Haval</a></li>
<li><a href="#">havalniraj@gmail.com</a></li>
</ul>
</div>
<div class="footer-col">
<h4>Our College</h4>
<ul>
<li><a href="#">DYPCET</a></li>
<li><a href="#">Phone: 0231 260 1433</a></li>
</ul>
</div>
<div class="footer-col">
<h4>follow us</h4>
<div class="social-links">
<a href="#"><i class="fab fa-github"></i></a>
<a href="#"><i class="fab fa-linkedin-in"></i></a>
<a href="#"><i class="fab fa-twitter"></i></a>
<a href="#"><i class="fab fa-facebook-f"></i></a>
</div>
</div>
</div>
</div>
</footer>
</div>
<!-- footer end -->
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous">
</script>
<script src="js/style.js"></script>
</body>
</html>