-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
74 lines (63 loc) · 1.76 KB
/
index.html
File metadata and controls
74 lines (63 loc) · 1.76 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
<!DOCTYPE html>
<html lang="ar">
<head>
<meta charset="UTF-8">
<title>N60 Hub</title>
<style>
body{background:#111;color:#fff;font-family:Arial;display:flex;justify-content:center;align-items:center;height:100vh}
.box{background:#000;padding:25px;width:350px}
.top{display:flex;justify-content:space-between;margin-bottom:10px}
input,button{width:100%;margin-top:10px;background:#111;color:#fff;border:1px solid #333;padding:10px}
.error{color:red;font-size:13px}
</style>
</head>
<body>
<div class="box">
<div class="top">
<span onclick="loginUI()">تسجيل دخول</span>
<span onclick="registerUI()">إنشاء حساب</span>
</div>
<div id="form"></div>
</div>
<script>
let users = JSON.parse(localStorage.getItem("users") || "{}");
function saveUsers(){
localStorage.setItem("users", JSON.stringify(users));
}
function loginUI(){
form.innerHTML = `
<input id="u" placeholder="يوزرك">
<input id="p" type="password" placeholder="كلمة المرور">
<button onclick="login()">دخول</button>
`;
}
function registerUI(){
form.innerHTML = `
<input id="u" placeholder="يوزرك">
<input id="p" type="password" placeholder="كلمة المرور">
<button onclick="register()">إنشاء</button>
<div class="error" id="err"></div>
`;
}
loginUI();
function register(){
if(users[u.value]){
err.innerText="عذراً هذا الحساب مستخدم";
return;
}
users[u.value] = {
password:p.value,
files:{}
};
saveUsers();
localStorage.setItem("currentUser", u.value);
location.href="panel.html";
}
function login(){
if(!users[u.value] || users[u.value].password !== p.value) return;
localStorage.setItem("currentUser", u.value);
location.href="panel.html";
}
</script>
</body>
</html>