This repository was archived by the owner on Aug 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
77 lines (75 loc) · 3.13 KB
/
index.php
File metadata and controls
77 lines (75 loc) · 3.13 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
<?php
$currentTheme = 'light'; // 默認主題
if (isset($_COOKIE['theme'])) {
$currentTheme = $_COOKIE['theme'];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - CyberSQLi</title>
<link rel="stylesheet" type="text/css" href="index.css">
<script>
document.addEventListener('DOMContentLoaded', (event) => {
let currentTheme = document.body.getAttribute('data-theme') || 'light';
let button = document.querySelector('.theme-toggle');
button.setAttribute('data-theme', currentTheme);
button.textContent = (currentTheme === 'dark') ? '🌞' : '🌙';
window.toggleTheme = function() {
let newTheme = (currentTheme === 'dark') ? 'light' : 'dark';
document.body.setAttribute('data-theme', newTheme);
button.setAttribute('data-theme', newTheme);
button.textContent = (newTheme === 'dark') ? '🌞' : '🌙';
document.cookie = `theme=${newTheme}; path=/; SameSite=Lax`;
currentTheme = newTheme;
}
});
</script>
</head>
<body data-theme="<?php echo $currentTheme; ?>">
<div class="login-container">
<h2>Login - Bad</h2>
<form method="POST" action="bad-login.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Login">
</form>
</div>
<div class="login-container">
<h2>Login - Good</h2>
<form method="POST" action="good-login.php">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Login">
</form>
</div>
<!-- footer at bottom-->
<footer>
<div>
<!-- <p>Created by Naculus</p> -->
<!-- copyright and auto get year -->
<p>copyright © <?php echo date("Y"); ?> <a href="https://www.naculus.com/">Naculus</a></p>
<!-- have link to refer to this github repo at naculus-official/CyberSQLi -->
<p><a href="https://www.github.com/naculus-official/Cyber-SQLi">Naculus-Official/Cyber-SQLi</a></p>
</div>
<div>
<!-- have link to refer to my github profile -->
<p><a href="https://www.github.com/naculus-official">Github: Naculus</a></p>
<button class="theme-toggle" onclick="toggleTheme()">切換主題</button>
</div>
</footer>
<script>
function toggleTheme() {
const currentTheme = document.body.getAttribute('data-theme');
const newTheme = (currentTheme === 'dark') ? 'light' : 'dark';
document.body.setAttribute('data-theme', newTheme);
}
</script>
</body>
</html>