blob: dab92010b93383bc3745378747f692bbe668eb47 (
plain) (
blame)
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
|
<?php
session_start();
if (isset($_SESSION["logged"]) && $_SESSION["logged"] === true) {
header("Location: fileManager.php");
exit();
}
if(isset($_POST["username"]) && isset($_POST["password"])) {
$u = $_POST["username"];
$p = $_POST["password"];
$passes = file("../passwords.txt");
foreach ($passes as $pass) {
$pass = explode(':', trim($pass));
if($pass[0] === $u && password_verify($p, $pass[1])) {
$_SESSION['logged'] = true;
$_SESSION['username'] = $u;
header("Location: fileManager.php");
exit();
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>sessionLogin</title>
<style>
body {
background-color: black;
color: white;
}
#form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
label {
margin-top: 0.75rem;
}
button {
background-color: #0000;
border: 3px solid #0056b3;
color: #0056b3;
font-size: 1.5rem;
padding: .5rem;
border-radius: .75rem;
}
</style>
</head>
<body style="display: grid; place-items: center; height: 100vh;">
<div style="width: min-content; font-size: 1.7rem; transform: translateY(-20%);">
<form method="post" action="index.php">
<label>
Name:
<input type="text" name="username" required><br>
</label><br>
<label>
Password:
<input type="password" name="password" required>
</label><br><br>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
|