Update index.html
Browse files- index.html +82 -9
index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
width: 300px;
|
| 15 |
margin: 100px auto 20px;
|
| 16 |
padding: 20px;
|
| 17 |
-
background: rgba(255, 255, 255, 0.
|
| 18 |
border-radius: 8px;
|
| 19 |
box-shadow: 0 0 10px rgba(0,0,0,0.3);
|
| 20 |
text-align: center;
|
|
@@ -44,15 +44,22 @@
|
|
| 44 |
font-size: 18px;
|
| 45 |
margin-bottom: 10px;
|
| 46 |
}
|
|
|
|
| 47 |
.terms-link {
|
| 48 |
text-align: center;
|
| 49 |
margin-top: 20px;
|
| 50 |
}
|
| 51 |
-
.terms-link
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
| 54 |
cursor: pointer;
|
| 55 |
}
|
|
|
|
|
|
|
|
|
|
| 56 |
/* Popup Terms */
|
| 57 |
#termsPopup {
|
| 58 |
position: fixed;
|
|
@@ -77,6 +84,7 @@
|
|
| 77 |
}
|
| 78 |
#termsBox h2 {
|
| 79 |
margin-top: 0;
|
|
|
|
| 80 |
}
|
| 81 |
#termsBox button {
|
| 82 |
margin-top: 15px;
|
|
@@ -107,16 +115,16 @@
|
|
| 107 |
</div>
|
| 108 |
</div>
|
| 109 |
|
| 110 |
-
<!--
|
| 111 |
<div class="terms-link">
|
| 112 |
-
<
|
| 113 |
</div>
|
| 114 |
|
| 115 |
<!-- Popup Terms -->
|
| 116 |
<div id="termsPopup">
|
| 117 |
<div id="termsBox">
|
| 118 |
<h2>Điều khoản sử dụng</h2>
|
| 119 |
-
<p>
|
| 120 |
<ul>
|
| 121 |
<li>Bạn có quyền truy cập nội dung sau khi đăng nhập thành công.</li>
|
| 122 |
<li>Mã đăng nhập chỉ có hiệu lực trong vòng 10 phút.</li>
|
|
@@ -124,5 +132,70 @@
|
|
| 124 |
<li>Không được chia sẻ mã đăng nhập cho người khác.</li>
|
| 125 |
</ul>
|
| 126 |
<h3>Hướng dẫn kỹ thuật (ẩn trong Terms)</h3>
|
| 127 |
-
<p>
|
| 128 |
-
<p>Ví dụ: <code>"admin"</code>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
width: 300px;
|
| 15 |
margin: 100px auto 20px;
|
| 16 |
padding: 20px;
|
| 17 |
+
background: rgba(255, 255, 255, 0.9);
|
| 18 |
border-radius: 8px;
|
| 19 |
box-shadow: 0 0 10px rgba(0,0,0,0.3);
|
| 20 |
text-align: center;
|
|
|
|
| 44 |
font-size: 18px;
|
| 45 |
margin-bottom: 10px;
|
| 46 |
}
|
| 47 |
+
/* Nút điều khoản */
|
| 48 |
.terms-link {
|
| 49 |
text-align: center;
|
| 50 |
margin-top: 20px;
|
| 51 |
}
|
| 52 |
+
.terms-link button {
|
| 53 |
+
padding: 8px 15px;
|
| 54 |
+
background: #333;
|
| 55 |
+
color: #fff;
|
| 56 |
+
border: none;
|
| 57 |
+
border-radius: 4px;
|
| 58 |
cursor: pointer;
|
| 59 |
}
|
| 60 |
+
.terms-link button:hover {
|
| 61 |
+
background: #555;
|
| 62 |
+
}
|
| 63 |
/* Popup Terms */
|
| 64 |
#termsPopup {
|
| 65 |
position: fixed;
|
|
|
|
| 84 |
}
|
| 85 |
#termsBox h2 {
|
| 86 |
margin-top: 0;
|
| 87 |
+
color: #4CAF50;
|
| 88 |
}
|
| 89 |
#termsBox button {
|
| 90 |
margin-top: 15px;
|
|
|
|
| 115 |
</div>
|
| 116 |
</div>
|
| 117 |
|
| 118 |
+
<!-- Nút mở Terms -->
|
| 119 |
<div class="terms-link">
|
| 120 |
+
<button onclick="openTerms()">Điều khoản sử dụng</button>
|
| 121 |
</div>
|
| 122 |
|
| 123 |
<!-- Popup Terms -->
|
| 124 |
<div id="termsPopup">
|
| 125 |
<div id="termsBox">
|
| 126 |
<h2>Điều khoản sử dụng</h2>
|
| 127 |
+
<p>Bằng việc sử dụng trang này, bạn đồng ý với các điều khoản sau:</p>
|
| 128 |
<ul>
|
| 129 |
<li>Bạn có quyền truy cập nội dung sau khi đăng nhập thành công.</li>
|
| 130 |
<li>Mã đăng nhập chỉ có hiệu lực trong vòng 10 phút.</li>
|
|
|
|
| 132 |
<li>Không được chia sẻ mã đăng nhập cho người khác.</li>
|
| 133 |
</ul>
|
| 134 |
<h3>Hướng dẫn kỹ thuật (ẩn trong Terms)</h3>
|
| 135 |
+
<p>Tên và mật khẩu được mã hoá bằng <b>Base64</b>.</p>
|
| 136 |
+
<p>Ví dụ: <code>"admin"</code> → <code>"YWRtaW4="</code>.</p>
|
| 137 |
+
<p>Cách giải mã trong JavaScript:</p>
|
| 138 |
+
<pre><code>const encoded = "YWRtaW4=";
|
| 139 |
+
const decoded = atob(encoded); // kết quả: "admin"</code></pre>
|
| 140 |
+
<button onclick="closeTerms()">Đóng</button>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
|
| 144 |
+
<script>
|
| 145 |
+
// Giấu tên và mật khẩu bằng Base64
|
| 146 |
+
const encodedUser = "YWRtaW4="; // "admin"
|
| 147 |
+
const encodedPass = "YWRtaW4="; // "admin"
|
| 148 |
+
|
| 149 |
+
let generatedCode = "";
|
| 150 |
+
let expiryTime = null;
|
| 151 |
+
|
| 152 |
+
function decode(str) {
|
| 153 |
+
return atob(str); // Giải mã Base64
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
function login() {
|
| 157 |
+
const user = document.getElementById("username").value;
|
| 158 |
+
const pass = document.getElementById("password").value;
|
| 159 |
+
|
| 160 |
+
if (user === decode(encodedUser) && pass === decode(encodedPass)) {
|
| 161 |
+
generatedCode = randomCode(8);
|
| 162 |
+
expiryTime = Date.now() + 10 * 60 * 1000; // 10 phút
|
| 163 |
+
document.getElementById("code").textContent = "Mã của bạn: " + generatedCode;
|
| 164 |
+
document.getElementById("codeBox").style.display = "block";
|
| 165 |
+
document.getElementById("error").textContent = "";
|
| 166 |
+
} else {
|
| 167 |
+
document.getElementById("error").textContent = "Sai tên đăng nhập hoặc mật khẩu!";
|
| 168 |
+
}
|
| 169 |
+
return false;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
function randomCode(length) {
|
| 173 |
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
| 174 |
+
let result = "";
|
| 175 |
+
for (let i = 0; i < length; i++) {
|
| 176 |
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
| 177 |
+
}
|
| 178 |
+
return result;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
function copyCode() {
|
| 182 |
+
navigator.clipboard.writeText(generatedCode);
|
| 183 |
+
alert("Đã copy mã!");
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
function goContact() {
|
| 187 |
+
localStorage.setItem("loginCode", generatedCode);
|
| 188 |
+
localStorage.setItem("expiryTime", expiryTime);
|
| 189 |
+
window.location.href = "contact.html";
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
function openTerms() {
|
| 193 |
+
document.getElementById("termsPopup").style.display = "flex";
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
function closeTerms() {
|
| 197 |
+
document.getElementById("termsPopup").style.display = "none";
|
| 198 |
+
}
|
| 199 |
+
</script>
|
| 200 |
+
</body>
|
| 201 |
+
</html>
|