-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.html
More file actions
52 lines (49 loc) · 1.71 KB
/
Copy pathlog.html
File metadata and controls
52 lines (49 loc) · 1.71 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
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
</head>
<body>
<center>
<br><br><br>
<h2> BlackRoad </h2>
<h3> Login </h3>
<br><br>
<input type="text" id="u" placeholder="Username"><br><br>
<input type="password" id="p" placeholder="Password"><br><br>
<button onclick="l()">Login</button>
<script>
function c(u, p, r) {
const d = indexedDB.open("black", 2);
d.onupgradeneeded = e => {
const db = e.target.result;
if (!db.objectStoreNames.contains("sst")) {
db.createObjectStore("sst");
}
};
d.onsuccess = e => {
const db = e.target.result;
const t = db.transaction("sst", "readonly");
const s = t.objectStore("sst");
const req = s.get("user");
req.onsuccess = () => {
const data = req.result;
if (data && (data.p === p && data.u===u)) {
localStorage.setItem("blackuser", u);
window.location.href = r;
} else {
alert("Invalid credentials");
}
};
req.onerror = () => alert("Error accessing data");
};
d.onerror = e => console.error("DB Error:", e.target.error);
}
function l() {
const u = document.getElementById("u").value;
const p = document.getElementById("p").value;
c(u, p, "finpulse.html");
}
</script>
</body>
</html>