/
index.php
116 lines (106 loc) · 3.71 KB
/
index.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
<!-- Author: Arpith K
arpith.xyz
Source: https://github.com/arpith20/oth
-->
<?php
session_start();
require_once("config.php");
$usn=clean_nospace($_POST['usn']); //unique serial
$password=$_POST['password']; //email
$valid_pass = 0;
if($usn!=NULL && $password != null)
{
$data=mysqli_query($con,"SELECT password FROM sheet where usn='$usn'")
or die(mysqli_error());
$info = mysqli_fetch_array( $data );
if(password_verify($password, $info[password])){
$valid_pass = 1;
}
if ($valid_pass == 1)
{
session_start();
$_SESSION["USN"] = $usn;
$sql="update sheet set session='".session_id()."' where usn='$usn'";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error());
}
redirect('respawn.php');
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>QUEST FOR D NEXT</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="assets/css/login.css" />
<link rel="shortcut icon" type="image/png" href="favicon.ico"/>
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
<noscript><link rel="stylesheet" href="assets/css/noscript.css" /></noscript>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body class="is-loading">
<!-- Wrapper -->
<div id="wrapper">
<!-- Main -->
<section id="main">
<header>
<img src="images/csa.png" alt="" height="81"/>
<hr/>
<h1>QUEST FOR D NEXT</h1>
<h2>Online Treasure Hunt</h2>
<p class="small">Ahoy, Mateys!<br/>
Welcome to the Online Treasure Hunt.<br/>
Play Sherlock Holmes on the expanse of the Internet!<br/>
Crawl the web to find secret troves of knowledge and unlock the next clue!</p>
</header>
<hr />
</footer>
<?
if($valid_pass == 0 && $password != null) {
echo "<p style=\"color:red;\">The username or password is incorrect";
echo "<hr />";
}
?>
<p class="small">LOGIN</p>
<form method="post" action="index.php">
<div class="field">
<input type="text" name="usn" placeholder="Username" maxlength="15"/>
</div>
<div class="field">
<input type="password" name="password" placeholder="Password" maxlength="40"/>
</div>
<input type="submit" value="Log in">
</form>
<hr />
<footer>
<ul class="icons">
<li><a href="register.php" class="fa-sign-in" title="Register">Register</a></li>
<a href="register.php"><p>To Create an account, register.</p></a>
</ul>
</footer>
<hr />
<footer>
<ul class="icons">
<li><a href="leaderboard.php" class="fa-child" title="Leaderboard" target="_blank">Leaderboard</a></li>
<li><a href="rules.php" class="fa-asterisk" title="Rules" target="_blank">Rules</a></li>
<li><a href="https://www.facebook.com" class="fa-facebook" title="Hints" target="_blank">Hints</a></li>
</ul>
</footer>
</section>
<footer id="footer">
<p><span style="opacity: 0.5;">Adapted from a template by HTML5Up</span></p>
</footer>
</div>
<script>
if ('addEventListener' in window) {
window.addEventListener('load', function() { document.body.className = document.body.className.replace(/\bis-loading\b/, ''); });
document.body.className += (navigator.userAgent.match(/(MSIE|rv:11\.0)/) ? ' is-ie' : '');
}
</script>
</body>
</html>