-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
61 lines (55 loc) · 2.11 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
<?php
session_start();
$showAlert = false;
if (isset($_SESSION['loggedin'])) {
header('Location: home.php');
exit;
}
include 'password.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($_POST['password'] == $password) {
$_SESSION['loggedin'] = true;
header('Location: home.php');
exit;
} else {
$showAlert = true;
$alertClass = "alert-danger";
$alertMsg = "Wrong password";
}
}
?>
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<!-- Bootstrap CSS -->
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-wEmeIV1mKuiNpC+IOBjI7aAzPcEZeedi5yW5f2yOq55WWLwNGmvvx4Um1vskeMj0' crossorigin='anonymous'>
<link rel="shortcut icon" type="image/x-icon" href="sharelogo.png">
<title>Share File and Text</title>
</head>
<body>
<center>
<?php
if ($showAlert) {
echo "<div class='alert $alertClass alert-dismissible fade show py-2 mb-0' role='alert'>
<strong >$alertMsg</strong>
<button type='button' class='btn-close pb-2' data-bs-dismiss='alert' aria-label='Close'></button>
</div>";
}
?>
<div class="mt-5 ">
<?php
$current_site = $_SERVER['SERVER_NAME'];
echo "<a class='' aria-current='page' href='http://$current_site'>$current_site</a>";
?>
<form action="index.php" method="post">
<input type="password" name="password" class="form-control mb-3 mt-5" style="width: 200px;" placeholder="enter password">
<button type="submit" class="btn btn-primary " style="width: 200px;">Login </button>
</form>
</div>
</center>
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0/dist/js/bootstrap.bundle.min.js' integrity='sha384-p34f1UUtsS3wqzfto5wAAmdvj+osOnFyQFpp4Ua3gs/ZVWx6oOypYoCJhGGScy+8' crossorigin='anonymous'></script>
</body>
</html>