-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
128 lines (113 loc) · 3.32 KB
/
Copy pathindex.php
File metadata and controls
128 lines (113 loc) · 3.32 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="pt">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Repositório</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<?php
$images = glob("images/common/rpd-wallpaper/*.jpg");
$indice = random_int(0, count($images)-1);
?>
<style type="text/css">
body
{
background: url("<?php echo $images[$indice]; ?>");
background-size: cover;
background-repeat: no-repeat;
overflow-y: auto;
max-height: 100vh;
}
.centered
{
position: fixed;
top: 42%;
left: 42%;
}
h6
{
font-size: 25px;
color: rgb(75, 75, 75);
}
.col-sm-3
{
opacity: 0.7;
background-color: rgb(255,255,255);
border-radius: 12px;
padding: 20px;
}
</style>
</head>
<body id="body" class="bg-image">
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
session_start();
if (isset($_SESSION['user']))
{
header("refresh:0;dashboard.php");
}
if (isset($_POST['user']) && isset($_POST['password']))
{
if (file_exists("users/" . $_POST['user'] . ".txt")) {
$passwd = file_get_contents("users/" . $_POST['user'] . ".txt");
if (hash("sha256", $_POST['password']) == $passwd)
{
$_SESSION['user'] = $_POST['user'];
header("refresh:0;dashboard.php");
}
else
{
echo "<script>alert('Password Errada')</script>";
}
}
else
{
echo "<script>alert('Utilizador não existe".$_POST['user']."')</script>";
}
}
?>
<div class="text-center container centered">
<div class="row">
<div class="col-sm-3">
<form method="POST" action="index.php">
<div class="col-mb-3">
<label class="form-label"><h6><b>Utilizador</b></h6></label><br>
<input type="text" name="user" class="form-control" placeholder="utilizador" required><br>
</div>
<div class="col-mb-3">
<label class="form-label"><h6><b>Password</b></h6></label><br>
<input type="password" name="password" class="form-control" placeholder="password" required><br><br>
</div>
<div class="col-mb-3">
<input type="submit" value="Login" class="btn btn-primary">
</div>
</form>
</div>
</div>
</div>
<script>
setInterval(() => {
<?php
echo "var lst = [";
foreach($images as $image)
{
if ($image != $images[count($images)-1])
{
echo "'" . $image . "', ";
}
else
{
echo "'" . $image . "'];";
}
}
echo "\nvar n = " . count($images) . ";\n";
?>
document.getElementById("body").style.backgroundImage = "url('" + lst[Math.floor(Math.random() * n)] + "')";
console.log(document.getElementById("body").style.backgroundImage);
}, 5000);
</script>
</body>
</html>