-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
admin.php
58 lines (45 loc) · 1.11 KB
/
admin.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
<?php
session_start();
include "connection.php";
if (isset($_SESSION['admin'])) {
header("location: adminhome.php");
}
if (isset($_POST['password'])) {
$password = mysqli_real_escape_string($conn , $_POST['password']);
$adminpass = '$2y$10$8WkSLFcoaqhJUJoqjg3K8eWixJWswsICf7FTxehKmx8hpmIKYWqju';
if (password_verify($password , $adminpass)) {
$_SESSION['admin'] = "active";
header("Location: adminhome.php");
}
else {
echo "<script> alert('wrong password');</script>";
}
}
?>
<html>
<head>
<title>PHP-kuiz</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<header>
<div class="container">
<h1>PHP-kuiz</h1>
<a href="index.php" class="start">Home</a>
</div>
</header>
<main>
<div class="container">
<h2>Enter Password</h2>
<form method="POST" action="">
<input type="password" name="password" required="" >
<input type="submit" name="submit" value="send">
</div>
</main>
<footer>
<div class="container">
Copyright @ PHP-kuiz
</div>
</footer>
</body>
</html>