-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.php
86 lines (71 loc) · 2.01 KB
/
404.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
<?php
function getUsers() {
$usersFile = 'users.json';
if (!file_exists($usersFile)) {
file_put_contents($usersFile, json_encode([]));
}
return json_decode(file_get_contents($usersFile), true);
}
function saveUsers($users) {
file_put_contents('users.json', json_encode($users, JSON_PRETTY_PRINT));
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username'];
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);
$users = getUsers();
foreach ($users as $user) {
if ($user['username'] == $username) {
echo "Username already exists.";
exit();
}
}
$users[] = ['username' => $username, 'password' => $password];
saveUsers($users);
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>404 - Not Found</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<style>
.container {
background-image: url('background.png');
background-size: 100% 100%; /* Adjusts the background image to cover the entire div */
background-position: center; /* Centers the background image */
background-repeat: no-repeat; /* Prevents the background image from repeating */
height: 500px; /* Makes the div take up the full viewport height */
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
max-width: 600px;
margin: 20px auto;
color: white;
}
.container a {
color: white;
}
.container input[type=text] {
background-color: #fff;
}
.container input[type=password] {
background-color: #fff;
}
</style>
</head>
<body>
<div class="container">
<h2>Error 404</h2>
<p>Error code: <code>404</code> | <button onclick="learnmore()"> Learn More </button></p>
<p> The requested location was not found on this server</p>
<script>
function learnmore(message) {
alert("You will be redirected to wikipedia.org");
window.location.href = ' https://en.wikipedia.org/wiki/HTTP_404';
}
</script>
</div>
</body>
</html>