This commit is contained in:
Jester
2026-01-19 08:35:00 +03:00
parent cbbc605336
commit 55b3d5f088
27 changed files with 183 additions and 841 deletions

36
index.html Normal file
View File

@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<title>Личный кабинет</title>
</head>
<body>
<div id="user-info"></div>
<button onclick="logout()">Выйти</button>
<script>
// Проверка авторизации при загрузке страницы
async function checkAuth() {
const response = await fetch('api/check_auth.php');
const result = await response.json();
if (!result.isLoggedIn) {
window.location.href = 'login.html';
} else {
document.getElementById('user-info').innerHTML = `
<h2>Добро пожаловать, ${result.user.username}!</h2>
`;
}
}
async function logout() {
await fetch('api/logout.php');
localStorage.removeItem('user');
localStorage.removeItem('isLoggedIn');
window.location.href = 'login.html';
}
// Проверяем авторизацию
checkAuth();
</script>
</body>
</html>