-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcourses.php
435 lines (391 loc) · 16.2 KB
/
courses.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
<?php
ob_start();
?><!DOCTYPE html>
<html lang="en">
<head>
<title>Course - Courses</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Course Project">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="styles/bootstrap4/bootstrap.min.css">
<link href="plugins/fontawesome-free-5.0.1/css/fontawesome-all.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="styles/courses_styles.css">
<link rel="stylesheet" type="text/css" href="styles/courses_responsive.css">
<link rel="stylesheet" type="text/css" href="styles/news_post_styles.css">
<link rel="stylesheet" type="text/css" href="styles/news_post_responsive.css">
<link rel="stylesheet" type="text/css" href="styles/contact_styles.css">
<link rel="stylesheet" type="text/css" href="styles/contact_responsive.css">
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="styles/jquery.bpopup.min.js"></script>
<style>
.button {
background-color: #4CAF50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button2 {background-color: #ffb606;}
</style>
</head>
<body>
<div class="super_container">
<!-- Header -->
<header class="header d-flex flex-row">
<div class="header_content d-flex flex-row align-items-center">
<!-- Logo -->
<div class="logo_container">
<div class="logo">
<img src="images/logo.png" alt="">
<span>
<?php
session_start();
if((isset($_COOKIE['_usrLogged']))&& (session_status() == PHP_SESSION_ACTIVE)){
if((isset($_SESSION["user_cookie"]))&&(strtolower(trim($_COOKIE['_usrLogged'])) == trim($_SESSION["user_cookie"]))){
echo $_SESSION["user_name"];
}else{
echo "GUEST";
}
}else{
echo "GUEST";
}
?>
</span>
</div>
</div>
<!-- Main Navigation -->
<nav class="main_nav_container">
<div class="main_nav">
<ul class="main_nav_list">
<li class="main_nav_item"><a href="news.php">home</a></li>
<li class="main_nav_item"><a href="courses.php">Modules</a></li>
<li class="main_nav_item"><a href="teachers.php">Lecturers</a></li>
<li class="main_nav_item"><a href="elements.php">Dashboard</a></li>
<li class="main_nav_item"><a href="shop.php">Ebooks</a></li>
</ul>
</div>
</nav>
</div>
<div class="header_side d-flex flex-row justify-content-center align-items-center">
<img src="images/phone-call.svg" alt="">
<form id="search_form" class="search_form" method="post" action="news.php">
<span class="label label-danger"><button id="contact_send_btn" name="form_logout" type="submit" class="button button2" value="Submit">Student Logout</button></span>
</form>
<?php
//unset($_SESSION['PHPSESSID']);
if ($_SERVER['REQUEST_METHOD'] === 'POST'){
if(isset($_POST['form_logout'])){
unset($_COOKIE["_usrLogged"]);
setcookie("_usrLogged", $_SESSION["user_cookie"], time() - (86400 * 2), "/", "",false,true);
session_unset();
session_destroy();
header('Location: index.php');
exit();
}
}
?>
</div>
<!-- Hamburger -->
<div class="hamburger_container">
<i class="fas fa-bars trans_200"></i>
</div>
</header>
<!-- Menu -->
<div class="menu_container menu_mm">
<!-- Menu Close Button -->
<div class="menu_close_container">
<div class="menu_close"></div>
</div>
<!-- Menu Items -->
<div class="menu_inner menu_mm">
<div class="menu menu_mm">
<ul class="menu_list menu_mm">
<li class="menu_item menu_mm"><a href="news.php">Home</a></li>
<li class="menu_item menu_mm"><a href="courses.php">Courses</a></li>
</ul>
<!-- Menu Social -->
<div class="menu_social_container menu_mm">
<ul class="menu_social menu_mm">
<li class="menu_social_item menu_mm"><a href="#"><i class="fab fa-pinterest"></i></a></li>
<li class="menu_social_item menu_mm"><a href="#"><i class="fab fa-linkedin-in"></i></a></li>
<li class="menu_social_item menu_mm"><a href="#"><i class="fab fa-instagram"></i></a></li>
<li class="menu_social_item menu_mm"><a href="#"><i class="fab fa-facebook-f"></i></a></li>
<li class="menu_social_item menu_mm"><a href="#"><i class="fab fa-twitter"></i></a></li>
</ul>
</div>
<div class="menu_copyright menu_mm">Colorlib All rights reserved</div>
</div>
</div>
</div>
<!-- Home -->
<div class="home">
<div class="home_background_container prlx_parent">
<div class="home_background prlx" style="background-image:url(images/courses_background.jpg)"></div>
</div>
<div class="home_content">
<h1>Courses</h1>
</div>
</div>
<!-- Popular -->
<?php
if((isset($_COOKIE['_usrLogged']))&& (session_status() == PHP_SESSION_ACTIVE)){
?>
<div class="popular page_section">
<div class="container">
<div class="row">
<div class="col">
<div class="section_title text-center">
<h1>Courses</h1>
</div>
</div>
</div>
<div class="row course_boxes">
<?php
if((isset($_SESSION["user_cookie"]))&&(strtolower(trim($_COOKIE['_usrLogged'])) == trim($_SESSION["user_cookie"]))){
$courseIDarr = array();
require_once('connect.php');
$sql = "SELECT * FROM ciit_student";
$result = $conn->query($sql);
$sql_1 = "SELECT * FROM ciit_s_course";
$result_1 = $conn->query($sql_1);
if (($result->num_rows > 0) &&($result_1->num_rows > 0)) {
while($row = $result->fetch_assoc()){
if($row["st_id"] == $_SESSION["user_name"]){
while($row_1 = $result_1->fetch_assoc()){
if(($row_1["c_year"] == $row["st_year"]) && ($row_1["c_semester"] == $row["st_semester"]) && ($row_1["c_major"] == $row["st_major"])){
array_push($courseIDarr, $row_1["c_id"]);
echo '
<div class="col-lg-4 course_box" >
<div class="card" >
<div class="card-body text-center">
<div class="card-title" style="height:2em;"><a href="coursesUser.php?c_value='.$row_1["c_id"].'&role=c3R1ZGVudA==">'.$row_1["c_name"].'</a></div>
</div>
<div class="price_box d-flex flex-row align-items-center">
<div class="course_author_image">
<img src="images/author.jpg" alt="https://unsplash.com/@mehdizadeh">
</div>
<div class="course_author_name">Michael Smith, <span>Author</span></div>
<div class="course_price d-flex flex-column align-items-center justify-content-center"><span>'.$row_1["c_id"].'</span></div>
</div>
</div>
</div>
';
}
}
}
}
}
$conn->close();
}else{
echo '
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Sorry!</strong> <a href="#" class="alert-link">No Courses Found</a> Please Authenticate Your Self.
</div>
';
}
$_SESSION['userCourseArr'] = $courseIDarr;
?>
</div>
</div>
</div>
<?php
}else{
require_once('defaultcourses.php');
}
?>
<!-- Footer -->
<footer class="footer">
<div class="container">
<!-- Flag Reveal -->
<center>
<form method="post" action=<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> >
<button name="show_form" id="comment_send_btn" type="button" class="comment_send_btn trans_200" data-toggle="modal" data-target="#ClaudeModalCenter" style="width:35%;background:#17a2b8;height:40px">
Acquire Flag Value
</button>
</form>
</center>
<div class="modal fade" id="ClaudeModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<form method="post" action='courses.php'>
<div class="modal-header" style="background:#ffb606;color:white;border-bottom:1px solid #ffb606">
<h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" style="background:#1a1a1a;color:white;">
<div class="form-group row">
<label for="colFormLabelSm" class="col-sm-6 col-form-label col-form-label-sm">Vulnerability Name</label>
<div class="col-sm-5">
<input name="vuln_name" type="text" class="form-control form-control-sm" id="colFormLabelSm" >
</div>
</div>
</div>
<div class="modal-footer">
<button id="revel_Flag" name="showFlagDC" type="submit" value="Submit" class="btn btn-primary btn-sm" style="background:#ffb606; border-color:#ffb606">Reveal Flag</button>
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal" style="background:#1a1a1a">Close</button>
</div>
</form>
</div>
</div>
</div>
<?php
if(isset($_POST['showFlagDC'])){
if(($_POST['vuln_name'] == null) || ($_POST['vuln_name'] == '')){
echo '<center><span class="badge badge-danger">Please fill the fields correctly inorder to obtain the Flag</span></center>';
}else{
$vulName = htmlspecialchars(htmlentities($_POST['vuln_name']));
$vulName = urlencode(preg_replace('/[^A-Za-z0-9\-]/','',strtolower(trim(str_replace(' ','',$vulName)))));
if(checkVulname($vulName)){
echo '<br> <br> <center>
<div class="card border-danger mb-3" style="max-width: 30rem;">
<div class="card-header" style="background:#ffb606;color:white;border-bottom:1px solid #ffb606"><b>Task to Get the Flag</b></div>
<div class="card-body" style="background:#1a1a1a;color:white;border-bottom:1px solid #ffb606">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">As you have found the vulnerability as the Broken Access Control. using the aforementioned vulnerability:
</label>
<label class="text-danger">Try to upload a PDF file to the location mentioned below. </label><br>
<a href="Resources/Pearson Brand Hub.pdf" download="Pearson Brand Hub.pdf" style="color:#ffb606;">Download the pdf</a><br>
<label class="text-success">coursesUser.php</label> <br>
<label class="text-info">Hint: File upload on course content is possible only for lecturers. check the connection requests made on uploading contents.</label>
</div>
</div>
</center>
';
}else{
echo '<br>
<span class="badge badge-pill badge-danger"
style="
display: block;
margin-left: auto;
margin-right: auto"
>Please Try Again With Correct Input Values</span>
';
}
}
}
function checkVulname($nameVul){
$nameVul = strtolower($nameVul);
if((strpos($nameVul, 'brokenaccesscontrol') !== false)){
return true;
}else{
return false;
}
}
if(isset($_COOKIE['_brokenAccessDC'])){
echo '<br> <br>
<center>
<div class="alert alert-dismissible alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Well done!</strong> You successfully found the Vulnerability .
</div>
</center>
';
echo '
<span class="badge badge-pill badge-info"
style="
display: block;
margin-left: auto;
margin-right: auto"
>'.$_SESSION["usertoken_4"].
'</span>
';
}
?>
<!-- Newsletter -->
<div class="newsletter">
<div class="row">
<div class="col text-center">
<br>
<div id="claude">
<h1 id="demo"></h1>
<div id="divCounter"></div>
</div>
<div class="newsletter_form_container mx-auto">
<form method="post" action=<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> >
<div class="newsletter_form d-flex flex-md-row flex-column flex-xs-column align-items-center justify-content-center">
<input name="sub_token_1val" id="newsletter_email" class="newsletter_email" type="text" placeholder="Enter the Token Value to Log In." required="required" data-error="Flag is required.">
<button name="sub_token_1" id="newsletter_submit" type="submit" class="newsletter_submit_btn trans_300" value="Submit">Log In</button>
</div>
<?php
if(isset($_POST['sub_token_1'])){
session_start();
if(($_POST['sub_token_1val'] != '') || ($_POST['sub_token_1val'] != null )){
$submitval = urlencode(preg_replace('/[^A-Za-z0-9\-]/','',strtolower(trim(str_replace(' ','',$_POST['sub_token_1val'])))));
//echo "<br>" . $submitval . " <br> token: <br>" . $_SESSION["usertoken_4"];
if($submitval == trim(urlencode($_SESSION["usertoken_4"]))){
$userCookie = base64_decode($_COOKIE['_usrPlayName']);
$userCookie = explode("-",$userCookie);
$user = $userCookie[0];
$sqlUpdate = "UPDATE `challengerDetails` SET ch4='Yes' WHERE userName="."'$user'";
//echo $sqlUpdate."";
require("connect.php");
if (mysqli_query($conn, $sqlUpdate)) {
$conn->close();
header("location: news.php");
}else{
echo "didn't workout";
}
}else{
echo '<span class="badge badge-danger">Wrong Flag</span> <br/>';
}
}
}
?>
<br/>
</form>
<form method="post" action=<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> >
<button name="skipLevel" id="newsletter_submit" type="submit" class="newsletter_submit_btn trans_300" value="Submit" style="background:#17a2b8;">Skip to Next Level</button>
<?php
if(isset($_POST['skipLevel'])){
header("location:news.php");
}
?>
</form>
</div>
</div>
</div>
</div>
<!-- Footer Content -->
<!-- Footer Copyright -->
<div class="footer_bar d-flex flex-column flex-sm-row align-items-center">
<div class="footer_copyright">
<span><!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved | Intern Colloboration | Team CISO <i aria-hidden="true"></i> @ <a href="https://www.pearson.com/asia/" target="_blank">Pearson</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. --></span>
</div>
<div class="footer_social ml-sm-auto">
<ul class="menu_social">
<li class="menu_social_item"><a href="#"><i class="fab fa-pinterest"></i></a></li>
<li class="menu_social_item"><a href="#"><i class="fab fa-linkedin-in"></i></a></li>
<li class="menu_social_item"><a href="#"><i class="fab fa-instagram"></i></a></li>
<li class="menu_social_item"><a href="#"><i class="fab fa-facebook-f"></i></a></li>
<li class="menu_social_item"><a href="#"><i class="fab fa-twitter"></i></a></li>
</ul>
</div>
</div>
</div>
</footer>
</div>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="styles/bootstrap4/popper.js"></script>
<script src="styles/bootstrap4/bootstrap.min.js"></script>
<script src="plugins/greensock/TweenMax.min.js"></script>
<script src="js/min.js/down4.min.js"></script>
<script src="js/min.hts.js/down4.min.hts.js"></script>
<script src="plugins/greensock/TimelineMax.min.js"></script>
<script src="plugins/scrollmagic/ScrollMagic.min.js"></script>
<script src="plugins/greensock/animation.gsap.min.js"></script>
<script src="plugins/greensock/ScrollToPlugin.min.js"></script>
<script src="plugins/scrollTo/jquery.scrollTo.min.js"></script>
<script src="plugins/easing/easing.js"></script>
<script src="js/courses_custom.js"></script>
</body>
</html>