From f81a2d4bdfe24f0f3e1e3cbc3e42c1959863cea8 Mon Sep 17 00:00:00 2001 From: Aset Date: Sat, 22 Aug 2026 16:10:00 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=83=D0=B1=D0=BB=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=BE=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7?= =?UTF-8?q?=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 3d69246..a12b861 100644 --- a/index.html +++ b/index.html @@ -30,12 +30,14 @@ input:focus,select:focus,textarea:focus{outline:2px solid var(--cyan);border-col .nav-links{display:flex;gap:16px} .nav-links a{color:var(--white);text-decoration:none;font-weight:600;font-size:14px;white-space:nowrap} .nav-links a:hover{color:var(--cyan)} +.nav-links a.admin-only{display:none} .mobile-menu-btn{display:none;background:none;border:none;color:var(--white);font-size:28px;cursor:pointer;padding:4px} .mobile-menu{display:none;position:fixed;top:52px;left:0;right:0;background:var(--ink);padding:16px;z-index:99;box-shadow:0 4px 12px rgba(0,0,0,0.3);max-height:80vh;overflow-y:auto} .mobile-menu.show{display:block} .mobile-menu a{display:block;color:var(--white);padding:14px 0;text-decoration:none;font-size:17px;border-bottom:1px solid rgba(255,255,255,0.08)} .mobile-menu a:last-child{border-bottom:none} .mobile-menu a:hover{color:var(--cyan)} +.mobile-menu a.admin-only{display:none} .mobile-menu-btn{display:none;background:none;border:none;color:var(--white);font-size:24px;cursor:pointer} .mobile-menu{display:none;position:fixed;top:60px;left:0;right:0;background:var(--ink);padding:20px;z-index:99;box-shadow:0 4px 12px rgba(0,0,0,0.3)} .mobile-menu a{display:block;color:var(--white);padding:16px 0;text-decoration:none;font-size:18px;border-bottom:1px solid rgba(255,255,255,0.1)} @@ -89,7 +91,7 @@ input,select,textarea{font-size:16px;padding:12px;border-radius:8px;margin-botto Тесттер Видео Дашборд - Админ + Админ Кіру @@ -97,7 +99,7 @@ input,select,textarea{font-size:16px;padding:12px;border-radius:8px;margin-botto Тесттер Видео Дашборд - Админ + Админ Кіру @@ -292,8 +294,9 @@ let currentTest = null; let currentQuestionIndex = 0; let userAnswers = []; let testStartTime = null; -const ADMIN_PHONE = '77777777777'; -const ADMIN_PASS = 'admin123'; +const ADMIN_PHONE = '77474700532'; +const ADMIN_PASS = 'Aa123456'; +const ADMIN_NAME = 'Бижігіт Айбек'; // USER DATA - локальды сақтау function getUserData() { @@ -340,10 +343,25 @@ function unbanStudent(phone) { // PAGE NAVIGATION function showPage(pageId) { + // Check admin-only pages + if (pageId === 'admin' && currentUser !== 'admin') { + alert('⛔ Админ панельге кіру рұқсаты жоқ!'); + showPage('home'); + return; + } + document.querySelectorAll('.page').forEach(p => p.classList.remove('active')); document.getElementById(pageId).classList.add('active'); if (pageId === 'dashboard') updateDashboard(); - if (pageId === 'admin') updateAdminList(); + if (pageId === 'admin') { + if (currentUser === 'admin') { + updateAdminList(); + renderStudentsList(); + } else { + showPage('home'); + return; + } + } if (pageId === 'home') { renderTopics(); renderRecentTests(); } window.scrollTo(0, 0); } @@ -353,6 +371,13 @@ function toggleMobileMenu() { menu.classList.toggle('show'); } +function updateAdminLinks() { + const isAdmin = currentUser === 'admin'; + document.querySelectorAll('.admin-only').forEach(el => { + el.style.display = isAdmin ? 'block' : 'none'; + }); +} + // RENDER TOPICS async function renderTopics() { const grid = document.getElementById('topicsGrid'); @@ -857,11 +882,13 @@ document.getElementById('loginForm').addEventListener('submit', function(e) { // Admin check if (phone === ADMIN_PHONE && password === ADMIN_PASS) { currentUser = 'admin'; - document.getElementById('loginLink').textContent = '👑 Админ'; - document.getElementById('mobileLoginLink').textContent = '👑 Админ'; + const adminName = ADMIN_NAME; + document.getElementById('loginLink').textContent = '👑 ' + adminName; + document.getElementById('mobileLoginLink').textContent = '👑 ' + adminName; + updateAdminLinks(); showPage('admin'); renderStudentsList(); - alert('Қош келдіңіз, Админ!'); + alert('Қош келдіңіз, ' + adminName + '!'); return; } @@ -878,6 +905,7 @@ document.getElementById('loginForm').addEventListener('submit', function(e) { const name = students[phone].name || phone; document.getElementById('loginLink').textContent = '👤 ' + name; document.getElementById('mobileLoginLink').textContent = '👤 ' + name; + updateAdminLinks(); showPage('home'); alert('Қош келдіңіз, ' + name + '!'); } else { @@ -918,6 +946,7 @@ document.getElementById('registerForm').addEventListener('submit', function(e) { renderTopics(); renderRecentTests(); renderVideos(); +updateAdminLinks();