-
Notifications
You must be signed in to change notification settings - Fork 0
/
4.php
157 lines (144 loc) · 5.86 KB
/
4.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
<?php
require '../com/config/DBHelper.php';
session_start();
$level = basename($_SERVER['SCRIPT_FILENAME'], ".php");
if (!isset($_SESSION['username'])) {
header("location:../index.php");
}
if (isset($_SESSION['username']) && $_SESSION['current_level'] != $level) {
header("location:" . $_SESSION['current_level'] . ".php");
}
if (isset($_SESSION['username']) && $_SESSION['on_block'] == $level) {
$now = date('Y-m-d H:i:s');
$time_to_unblock = date($_SESSION['when_to_unblock']);
if ($time_to_unblock <= $now) {
$db = new DBHelper();
$con = $db->getConnection();
$username = $_SESSION['username'];
$query = "UPDATE track_records SET on_block=0 WHERE username='$username'";
$con->query($query);
$_SESSION['on_block'] = 0;
} else {
header("location:blocked.php");
}
}
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>hack_it</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="../site.webmanifest">
<!-- Place favicon.ico in the root directory -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.teal-amber.min.css"/>
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<!--<link rel="stylesheet" href="../css/materialize.css" >-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css" media="screen,projection"/>
<link rel="stylesheet" href="../css/main.css">
<style>
.toast {
width: 50%;
border-radius: 0;
}
#toast-container {
min-width: 100%;
bottom: 70%;
top: 0%;
right: 0%;
left: 25%;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="../js/materialize.min.js"></script>
<script>
$(document).ready(function () {
$(".button-collapse").sideNav();
$("#hntbtn").click(function (e) {
e.preventDefault();
$.ajax({
type: "POST",
url: "get_hint.php",
data: {},
success: function (result) {
//alert('ok:' + result);
var $toastContent = '<span style="word-wrap: break-word">' + result + '</span><button class="btn-flat toast-action" onclick="dismissToast()">Dismiss</button>';
Materialize.toast($toastContent, 100000);
},
error: function (result) {
//alert('error');
}
});
});
});
function dismissToast() {
Materialize.Toast.removeAll();
}
</script>
</head>
<body>
<!--[if lte IE 9]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade
your browser</a> to improve your experience and security.</p>
<![endif]-->
<nav>
<div class="nav-wrapper">
<a href="../index.php" class="brand-logo"> hack_it</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="">Level : <?php echo $_SESSION['current_level'] ?></a></li>
<li><a href="../lboard.php">Leaderboard</a></li>
<li><a href="https://www.reddit.com/r/hack_it/" target="_blank">r/hack_it</a></li>
<li><a href="../about.php">About</a></li>
<li><a href="../logout.php">Log Out</a></li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li class="userView email"><a href=""><?php echo $_SESSION['username']; ?></a></li>
<li><a href="">Level : <?php echo $_SESSION['current_level'] ?></a></li>
<li><a href="../lboard.php">Leaderboard</a></li>
<li><a href="https://www.reddit.com/r/hack_it/" target="_blank">r/hack_it</a></li>
<li><a href="../about.php">About</a></li>
<li><a href="../logout.php">Log Out</a></li>
</ul>
</div>
</nav>
<div class="row" id="ques">
<form class="col m6 s12" action="answer_verification.php" method="post">
<div class="row">
<iframe class="myIframe" src="https://www.youtube.com/embed/lRs72x7Lgtc?start=34&end=65" frameborder="0"
allow="autoplay; encrypted-media" allowfullscreen></iframe>
<script type="text/javascript" language="javascript">
$('.myIframe').css('height', $(window).height() * .5 + 'px');
</script>
<div class="input-field col s12">
<input name="answer" id="input1" class="input-field inline" type="text">
<br/>
<label for="input1">Answer</label>
</div>
</div>
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
<i class="material-icons right">send</i>
</button>
<br>
<br>
<button class="btn waves-effect waves-light" id="hntbtn">Hint ?</button>
<div class="col s12">
<span class="error"><?php if (isset($_GET['a']) && ($_GET['a']) == 'f') {
echo "Answer is incorrect. Try again!";
} ?></span></div>
</form>
</div>
</body>
</html>