759 lines
30 KiB
PHP
759 lines
30 KiB
PHP
<?php
|
||
session_start();
|
||
|
||
if (isset($_GET['action']) && $_GET['action'] == 'go_to_catalog') {
|
||
if (!isset($_SESSION['isLoggedIn']) || $_SESSION['isLoggedIn'] !== true) {
|
||
|
||
header('Location: login.php?redirect=' . urlencode('catalog.php'));
|
||
exit();
|
||
} else {
|
||
|
||
header('Location: catalog.php');
|
||
exit();
|
||
}
|
||
}
|
||
?>
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<title>AETERNA - Мебель и Интерьер</title>
|
||
<link rel="stylesheet/less" type="text/css" href="style_for_cite.less">
|
||
<script src="https://cdn.jsdelivr.net/npm/less"></script>
|
||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
||
<style>
|
||
|
||
.user-profile-dropdown {
|
||
position: relative;
|
||
display: inline-block;
|
||
}
|
||
|
||
.user-profile-toggle {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
cursor: pointer;
|
||
padding: 8px 12px;
|
||
border-radius: 4px;
|
||
transition: all 0.3s ease;
|
||
}
|
||
|
||
.user-profile-toggle:hover {
|
||
background-color: rgba(0, 0, 0, 0.05);
|
||
}
|
||
|
||
.user-avatar {
|
||
width: 36px;
|
||
height: 36px;
|
||
border-radius: 50%;
|
||
background: linear-gradient(135deg, #617365 0%, #453227 100%);
|
||
color: white;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-weight: bold;
|
||
font-size: 16px;
|
||
}
|
||
|
||
.user-info {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.user-email {
|
||
font-size: 12px;
|
||
color: #666;
|
||
max-width: 120px;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.user-status {
|
||
font-size: 10px;
|
||
padding: 2px 8px;
|
||
border-radius: 12px;
|
||
text-transform: uppercase;
|
||
font-weight: bold;
|
||
text-align: center;
|
||
margin-top: 2px;
|
||
}
|
||
|
||
.user-status.admin {
|
||
background-color: #617365;
|
||
color: white;
|
||
}
|
||
|
||
.user-status.user {
|
||
background-color: #28a745;
|
||
color: white;
|
||
}
|
||
|
||
.dropdown-arrow {
|
||
font-size: 12px;
|
||
color: #666;
|
||
}
|
||
|
||
.user-profile-menu {
|
||
display: none;
|
||
position: absolute;
|
||
top: 100%;
|
||
right: 0;
|
||
background: white;
|
||
min-width: 280px;
|
||
border-radius: 8px;
|
||
box-shadow: 0 5px 20px rgba(0,0,0,0.15);
|
||
z-index: 1000;
|
||
padding-top: 10px;
|
||
border: 1px solid #e0e0e0;
|
||
overflow: visible;
|
||
}
|
||
|
||
.user-profile-menu::before {
|
||
content: '';
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
height: 10px;
|
||
background: transparent;
|
||
}
|
||
|
||
.user-profile-dropdown:hover .user-profile-menu {
|
||
display: block;
|
||
}
|
||
|
||
.user-profile-header {
|
||
padding: 15px;
|
||
background: #f8f9fa;
|
||
border-bottom: 1px solid #e0e0e0;
|
||
}
|
||
|
||
.user-profile-name {
|
||
font-weight: bold;
|
||
margin-bottom: 5px;
|
||
color: #333;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
|
||
.user-profile-details {
|
||
font-size: 12px;
|
||
color: #666;
|
||
}
|
||
|
||
.user-profile-details small {
|
||
display: block;
|
||
margin-bottom: 3px;
|
||
}
|
||
|
||
.user-profile-details i {
|
||
width: 16px;
|
||
text-align: center;
|
||
}
|
||
|
||
.user-profile-links {
|
||
list-style: none;
|
||
padding: 10px 0;
|
||
margin: 0;
|
||
}
|
||
|
||
.user-profile-links li {
|
||
margin: 0;
|
||
}
|
||
|
||
.user-profile-links a {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
padding: 10px 15px;
|
||
color: #333;
|
||
text-decoration: none;
|
||
transition: all 0.3s ease;
|
||
border-left: 3px solid transparent;
|
||
}
|
||
|
||
.user-profile-links a:hover {
|
||
background-color: #f5f5f5;
|
||
border-left-color: #453227;
|
||
color: #453227;
|
||
}
|
||
|
||
.user-profile-links i {
|
||
width: 20px;
|
||
text-align: center;
|
||
}
|
||
|
||
.logout-item {
|
||
border-top: 1px solid #e0e0e0;
|
||
margin-top: 5px;
|
||
padding-top: 5px;
|
||
}
|
||
|
||
.logout-link {
|
||
color: #dc3545 !important;
|
||
}
|
||
|
||
.logout-link:hover {
|
||
background-color: #ffe6e6 !important;
|
||
border-left-color: #dc3545 !important;
|
||
}
|
||
|
||
.cart-icon {
|
||
position: relative;
|
||
margin-right: 15px;
|
||
}
|
||
|
||
.cart-count {
|
||
position: absolute;
|
||
top: -8px;
|
||
right: -8px;
|
||
background: #dc3545;
|
||
color: white;
|
||
border-radius: 50%;
|
||
width: 18px;
|
||
height: 18px;
|
||
font-size: 11px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.link-disabled {
|
||
cursor: not-allowed !important;
|
||
opacity: 0.6 !important;
|
||
position: relative;
|
||
}
|
||
|
||
.link-disabled:hover::after {
|
||
content: "🔒 Требуется авторизация";
|
||
position: absolute;
|
||
top: -30px;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
background: #333;
|
||
color: white;
|
||
padding: 5px 10px;
|
||
border-radius: 4px;
|
||
font-size: 12px;
|
||
white-space: nowrap;
|
||
z-index: 1000;
|
||
}
|
||
|
||
.catalog-locked {
|
||
position: relative;
|
||
}
|
||
|
||
.catalog-locked::before {
|
||
content: "🔒";
|
||
position: absolute;
|
||
top: -5px;
|
||
right: -5px;
|
||
font-size: 12px;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<body>
|
||
<header class="header">
|
||
<div class="header__top">
|
||
<div class="container header__top-content">
|
||
<div class="logo">AETERNA</div>
|
||
|
||
<div class="search-catalog">
|
||
<div class="catalog-dropdown">
|
||
Все категории <span>▼</span>
|
||
<div class="catalog-dropdown__menu">
|
||
<ul>
|
||
<li><a href="javascript:void(0)" onclick="checkAuth('catalog.php?category=1')">Диваны</a></li>
|
||
<li><a href="javascript:void(0)" onclick="checkAuth('catalog.php?category=2')">Кровати</a></li>
|
||
<li><a href="javascript:void(0)" onclick="checkAuth('catalog.php?category=3')">Шкафы</a></li>
|
||
<li><a href="javascript:void(0)" onclick="checkAuth('catalog.php?category=4')">Стулья</a></li>
|
||
<li><a href="javascript:void(0)" onclick="checkAuth('catalog.php?category=5')">Столы</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div class="search-box">
|
||
<input type="text" placeholder="Поиск товаров" id="searchInput">
|
||
<span class="search-icon"><i class="fas fa-search"></i></span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="header__icons--top">
|
||
<?php if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true): ?>
|
||
|
||
<a href="checkout.php" class="icon cart-icon">
|
||
<i class="fas fa-shopping-cart"></i>
|
||
<span class="cart-count">0</span>
|
||
</a>
|
||
|
||
<div class="user-profile-dropdown">
|
||
<div class="user-profile-toggle">
|
||
<div class="user-avatar">
|
||
<?php
|
||
$email = $_SESSION['user_email'] ?? '';
|
||
echo !empty($email) ? strtoupper(substr($email, 0, 1)) : 'U';
|
||
?>
|
||
</div>
|
||
<div class="user-info">
|
||
<div class="user-email"><?= htmlspecialchars($email) ?></div>
|
||
<div class="user-status <?= isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] ? 'admin' : 'user' ?>">
|
||
<?= isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] ? 'Админ' : 'Пользователь' ?>
|
||
</div>
|
||
</div>
|
||
<i class="fas fa-chevron-down dropdown-arrow"></i>
|
||
</div>
|
||
|
||
<div class="user-profile-menu">
|
||
<div class="user-profile-header">
|
||
<div class="user-profile-name">
|
||
<i class="fas fa-user"></i>
|
||
<?= htmlspecialchars($_SESSION['full_name'] ?? $email) ?>
|
||
</div>
|
||
<div class="user-profile-details">
|
||
<small><i class="far fa-envelope"></i> <?= htmlspecialchars($email) ?></small>
|
||
<?php if (isset($_SESSION['login_time'])): ?>
|
||
<small><i class="far fa-clock"></i> Вошел: <?= date('d.m.Y H:i', $_SESSION['login_time']) ?></small>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
|
||
<ul class="user-profile-links">
|
||
<li>
|
||
<a href="register.php">
|
||
<i class="fas fa-user-cog"></i>
|
||
<span>Настройки профиля</span>
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="checkout.php">
|
||
<i class="fas fa-shopping-bag"></i>
|
||
<span>Мои заказы</span>
|
||
</a>
|
||
</li>
|
||
<?php if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin']): ?>
|
||
<li>
|
||
<a href="catalog_admin.php">
|
||
<i class="fas fa-user-shield"></i>
|
||
<span>Панель администратора</span>
|
||
</a>
|
||
</li>
|
||
<?php endif; ?>
|
||
<li class="logout-item">
|
||
<a href="logout.php" class="logout-link">
|
||
<i class="fas fa-sign-out-alt"></i>
|
||
<span>Выйти из аккаунта</span>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
<?php else: ?>
|
||
|
||
<a href="/login.php" class="icon">
|
||
<i class="far fa-user"></i>
|
||
</a>
|
||
<a href="/login.php" style="font-size: 12px; color: #666; margin-left: 5px;">
|
||
Войти
|
||
</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="header__bottom">
|
||
<div class="container header__bottom-content">
|
||
<div class="catalog-menu">
|
||
<a href="/catalog.php"
|
||
class="catalog-link <?= (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true) ? '' : 'catalog-locked' ?>">
|
||
<div class="catalog-icon">
|
||
<span class="line"></span>
|
||
<span class="line"></span>
|
||
<span class="line"></span>
|
||
</div>
|
||
<span class="catalog-lines">☰</span>
|
||
Каталог
|
||
</a>
|
||
</div>
|
||
|
||
<nav class="nav">
|
||
<ul class="nav-list">
|
||
<li><a href="cite_mebel.php" class="active">Главная</a></li>
|
||
<li><a href="services.php">Услуги</a></li>
|
||
<li><a href="delivery.php">Доставка и оплата</a></li>
|
||
<li><a href="warranty.php">Гарантия</a></li>
|
||
<li><a href="#footer">Контакты</a></li>
|
||
</ul>
|
||
</nav>
|
||
<div class="header-phone">+7(912)999-12-23</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<main>
|
||
<section class="hero">
|
||
<div class="container hero__content">
|
||
<div class="hero__image-block">
|
||
<div class="hero__circle"></div>
|
||
<img src="img/chair.PNG" alt="Кресло и торшер" class="hero__img">
|
||
</div>
|
||
<div class="hero__text-block">
|
||
<h1>ДОБАВЬТЕ ИЗЫСКАННОСТИ В СВОЙ ИНТЕРЬЕР</h1>
|
||
<p class="hero__usp-text">Мы создаем мебель, которая сочетает в себе безупречный дизайн, натуральные материалы, продуманный функционал, чтобы ваш день начинался и заканчивался с комфортом.</p>
|
||
|
||
<?php if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true): ?>
|
||
<a href="?action=go_to_catalog" class="btn primary-btn">ПЕРЕЙТИ В КАТАЛОГ</a>
|
||
<?php else: ?>
|
||
<a href="javascript:void(0)" onclick="checkAuth('catalog.php')" class="btn primary-btn link-disabled">ПЕРЕЙТИ В КАТАЛОГ</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="advantages">
|
||
<div class="container">
|
||
<div class="advantages__header">
|
||
<h2>ПОЧЕМУ <br>ВЫБИРАЮТ НАС?</h2>
|
||
<div class="advantages__items">
|
||
<div class="advantage-item">
|
||
<span class="advantage-item__number">1</span>
|
||
<h4>ГАРАНТИЯ ВЫСОЧАЙШЕГО КАЧЕСТВА</h4>
|
||
<p>Собственное производство и строгий контроль на всех этапах.</p>
|
||
</div>
|
||
<div class="advantage-item">
|
||
<span class="advantage-item__number">2</span>
|
||
<h4>ИСПОЛЬЗОВАНИЕ НАДЕЖНЫХ МАТЕРИАЛОВ</h4>
|
||
<p>Гарантия безопасности и долговечности.</p>
|
||
</div>
|
||
<div class="advantage-item">
|
||
<span class="advantage-item__number">3</span>
|
||
<h4>ИНДИВИДУАЛЬНЫЙ ПОДХОД И ГИБКОСТЬ УСЛОВИЙ</h4>
|
||
<p>Реализуем проекты любой сложности по вашим техническим заданиям.</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="promo-images">
|
||
<div class="promo-image-col">
|
||
<img src="img/спальня.jpg" alt="Кровать и тумба">
|
||
<div class="image-overlay-text">
|
||
<h4>НОВИНКИ В КАТЕГОРИЯХ <br>МЯГКАЯ МЕБЕЛЬ</h4>
|
||
<a href="#" class="overlay-link">ПЕРЕЙТИ</a>
|
||
</div>
|
||
</div>
|
||
<div class="promo-image-col">
|
||
<img src="img/диван.jpg" alt="Диван в гостиной">
|
||
<div class="image-overlay-text">
|
||
<h4>РАСПРОДАЖА <br>ПРЕДМЕТЫ ДЕКОРА</h4>
|
||
<a href="#" class="overlay-link">ПЕРЕЙТИ</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="about">
|
||
<div class="container about__content">
|
||
<div class="about__column about__column--left">
|
||
<div class="about__text-block">
|
||
<h2>О НАС</h2>
|
||
<p class="text-justified">Компания AETERNA - российский производитель качественной корпусной и мягкой мебели для дома и офиса. С 2015 года мы успешно реализуем проекты любой сложности, сочетая современные технологии, проверенные материалы и классическое мастерство.</p>
|
||
</div>
|
||
<img src="img/кресло_1.jpg" alt="Фиолетовое кресло" class="about__img about__img--small">
|
||
</div>
|
||
|
||
<div class="about__column about__column--right">
|
||
<img src="img/диван_1.jpg" alt="Белый диван с подушками" class="about__img about__img--large">
|
||
<p class="about__caption">Наша сеть включает 30+ российских фабрик, отобранных по строгим стандартам качества. Мы сотрудничаем исключительно с лидерами рынка, чья продукция доказала свое превосходство временем.</p>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="solutions">
|
||
<div class="container">
|
||
<div class="solutions-slider">
|
||
<div class="solutions-slider__slides">
|
||
<div class="solutions-slider__slide">
|
||
<img src="img/слайдер_1.jpg" class="solution-img" alt="Готовое решение для гостиной">
|
||
<div class="solution-text-overlay">
|
||
<h2>ГОТОВОЕ РЕШЕНИЕ<br>ДЛЯ ВАШЕЙ ГОСТИНОЙ</h2> <br>
|
||
<p>УСПЕЙТЕ ЗАКАЗАТЬ СЕЙЧАС</p>
|
||
</div>
|
||
<a href="#" class="solution-image-link">Подробнее</a>
|
||
</div>
|
||
|
||
<div class="solutions-slider__slide">
|
||
<img src="img/слайдер_6.jpg" class="solution-img" alt="Готовое решение для спальни">
|
||
<div class="solution-text-overlay">
|
||
<h2>ГОТОВОЕ РЕШЕНИЕ<br>ДЛЯ ВАШЕЙ СПАЛЬНИ</h2> <br>
|
||
<p>УСПЕЙТЕ ЗАКАЗАТЬ СЕЙЧАС</p>
|
||
</div>
|
||
<a href="#" class="solution-image-link">Подробнее</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="stats">
|
||
<div class="container">
|
||
<div class="stats__items">
|
||
<div class="stat-item">
|
||
<div class="stat-number">10+</div>
|
||
<div class="stat-label">Лет работы</div>
|
||
</div>
|
||
<div class="stat-item">
|
||
<div class="stat-number">30 000+</div>
|
||
<div class="stat-label">Довольных покупателей</div>
|
||
</div>
|
||
<div class="stat-item">
|
||
<div class="stat-number">4500+</div>
|
||
<div class="stat-label">Реализованных заказов</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="faq" id="faq">
|
||
<div class="container">
|
||
<h2>ОТВЕТЫ НА ВОПРОСЫ</h2>
|
||
<div class="faq__items">
|
||
<div class="faq-item">
|
||
<span class="number-circle">1</span>
|
||
<div class="faq-item__content">
|
||
<h4>Сколько времени занимает доставка?</h4>
|
||
<p>Доставка готовых позиций занимает 1-3 дня. Мебель на заказ изготавливается от 14 до 45 рабочих дней, в зависимости от сложности. Точные сроки озвучит ваш менеджер при оформлении заказа.</p>
|
||
</div>
|
||
</div>
|
||
<div class="faq-item">
|
||
<span class="number-circle">2</span>
|
||
<div class="faq-item__content">
|
||
<h4>Нужно ли вносить предоплату?</h4>
|
||
<p>Да, для запуска заказа в производство необходима предоплата в размере 50-70% от стоимости, в зависимости от изделия. Оставшаяся сумма оплачивается при доставке и приемке мебели.</p>
|
||
</div>
|
||
</div>
|
||
<div class="faq-item">
|
||
<span class="number-circle">3</span>
|
||
<div class="faq-item__content">
|
||
<h4>Предоставляется ли рассрочка или кредит?</h4>
|
||
<p>Да, мы сотрудничаем с несколькими банками и предлагаем рассрочку на 6 или 12 месяцев без первоначального взноса, а также кредит на более длительный срок. Все условия уточняйте у вашего менеджера.</p>
|
||
</div>
|
||
</div>
|
||
<div class="faq-item">
|
||
<span class="number-circle">4</span>
|
||
<div class="faq-item__content">
|
||
<h4>Что делать, если мебель пришла с дефектом?</h4>
|
||
<p>В этом случае необходимо в течение 7 дней со дня доставки сообщить нам о проблеме, прислать фото/видео дефекта. Мы оперативно решим вопрос о бесплатной замене или ремонте изделия.</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<button class="btn primary-btn">Задать вопрос</button>
|
||
</div>
|
||
</section>
|
||
</main>
|
||
|
||
<footer class="footer" id="footer">
|
||
<div class="container footer__content">
|
||
<div class="footer__col footer--logo">
|
||
<div class="logo">AETERNA</div>
|
||
</div>
|
||
|
||
<div class="footer__col">
|
||
<h5>ПОКУПАТЕЛЮ</h5>
|
||
<ul>
|
||
<li><a href="javascript:void(0)" onclick="checkAuth('catalog.php')">Каталог</a></li>
|
||
<li><a href="services.php">Услуги</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="footer__col">
|
||
<h5>ПОМОЩЬ</h5>
|
||
<ul>
|
||
<li><a href="delivery.php">Доставка и оплата</a></li>
|
||
<li><a href="warranty.php">Гарантия и возврат</a></li>
|
||
<li><a href="cite_mebel.html#faq">Ответы на вопросы</a></li>
|
||
<li><a href="#footer">Контакты</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="footer__col">
|
||
<h5>КОНТАКТЫ</h5>
|
||
<p>aeterna@mail.ru</p>
|
||
<p>+7(912)999-12-23</p>
|
||
<div class="social-icons">
|
||
<span class="icon"><i class="fab fa-telegram"></i></span>
|
||
<span class="icon"><i class="fab fa-instagram"></i></span>
|
||
<span class="icon"><i class="fab fa-vk"></i></span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="footer__col">
|
||
<h5>ПРИНИМАЕМ К ОПЛАТЕ</h5>
|
||
<div class="payment-icons">
|
||
<span class="pay-icon"><i class="fab fa-cc-visa"></i></span>
|
||
<span class="pay-icon"><i class="fab fa-cc-mastercard"></i></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="copyright">
|
||
<p>© 2025 AETERNA. Все права защищены.</p>
|
||
</div>
|
||
</footer>
|
||
|
||
<div class="user-status-overlay" id="userStatus" style="display: none; position: fixed; top: 20px; right: 20px; z-index: 1000; background: white; padding: 10px 15px; border-radius: 5px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
||
<div style="display: flex; align-items: center; gap: 10px;">
|
||
<i class="fas fa-user" id="statusIcon"></i>
|
||
<div>
|
||
<div id="statusText" style="font-weight: bold;"></div>
|
||
<div id="userEmail" style="font-size: 12px; color: #666;"></div>
|
||
</div>
|
||
<button onclick="logout()" style="background: none; border: none; color: #666; cursor: pointer; margin-left: 10px;">
|
||
<i class="fas fa-sign-out-alt"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="quick-login-modal" id="quickLoginModal" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; align-items: center; justify-content: center;">
|
||
<div style="background: white; padding: 30px; border-radius: 10px; width: 90%; max-width: 400px; text-align: center;">
|
||
<h3 style="margin-bottom: 20px; color: #453227;">
|
||
<i class="fas fa-sign-in-alt"></i> Быстрый вход
|
||
</h3>
|
||
<div style="margin-bottom: 20px;">
|
||
<button onclick="quickLogin('admin')" style="width: 100%; padding: 12px; background: #617365; color: white; border: none; border-radius: 4px; margin-bottom: 10px; cursor: pointer;">
|
||
<i class="fas fa-user-shield"></i> Войти как Администратор
|
||
</button>
|
||
<button onclick="quickLogin('user')" style="width: 100%; padding: 12px; background: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
||
<i class="fas fa-user"></i> Войти как Пользователь
|
||
</button>
|
||
</div>
|
||
<div style="font-size: 12px; color: #666; margin-top: 15px;">
|
||
Для полного функционала перейдите на страницу входа
|
||
</div>
|
||
<div style="margin-top: 20px; display: flex; gap: 10px; justify-content: center;">
|
||
<a href="вход.html" class="btn primary-btn" style="padding: 8px 15px; font-size: 14px;">
|
||
Полный вход
|
||
</a>
|
||
<button onclick="hideQuickLogin()" class="btn" style="padding: 8px 15px; font-size: 14px; background: #6c757d; color: white;">
|
||
Отмена
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
|
||
function checkAuth(redirectUrl) {
|
||
|
||
window.location.href = 'cite_mebel.php?action=go_to_catalog';
|
||
return true;
|
||
}
|
||
|
||
$(document).ready(function() {
|
||
|
||
<?php if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn'] === true): ?>
|
||
if (localStorage.getItem('isLoggedIn') !== 'true') {
|
||
localStorage.setItem('isLoggedIn', 'true');
|
||
localStorage.setItem('user_email', '<?= addslashes($_SESSION['user_email'] ?? '') ?>');
|
||
localStorage.setItem('isAdmin', '<?= isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] ? 'true' : 'false' ?>');
|
||
}
|
||
<?php endif; ?>
|
||
|
||
const isLoggedIn = localStorage.getItem('isLoggedIn') === 'true';
|
||
|
||
if (!isLoggedIn) {
|
||
|
||
$('a[href*="catalog"]').each(function() {
|
||
const originalHref = $(this).attr('href');
|
||
if (originalHref && originalHref.includes('catalog')) {
|
||
$(this).attr('href', 'javascript:void(0)');
|
||
$(this).addClass('link-disabled');
|
||
$(this).click(function(e) {
|
||
e.preventDefault();
|
||
checkAuth(originalHref);
|
||
});
|
||
}
|
||
});
|
||
|
||
$('#searchInput').prop('disabled', true).attr('placeholder', 'Войдите для поиска');
|
||
}
|
||
});
|
||
|
||
function quickLogin(role) {
|
||
let email, password;
|
||
|
||
if (role === 'admin') {
|
||
email = 'admin@aeterna.ru';
|
||
password = 'admin123';
|
||
} else {
|
||
email = 'user@test.com';
|
||
password = 'user123';
|
||
}
|
||
|
||
$.ajax({
|
||
url: 'login_handler.php',
|
||
method: 'POST',
|
||
data: {
|
||
email: email,
|
||
password: password
|
||
},
|
||
success: function(response) {
|
||
try {
|
||
const result = JSON.parse(response);
|
||
if (result.success) {
|
||
|
||
localStorage.setItem('isLoggedIn', 'true');
|
||
localStorage.setItem('user_email', email);
|
||
localStorage.setItem('isAdmin', (role === 'admin').toString());
|
||
|
||
alert('Вы вошли как ' + (role === 'admin' ? 'администратор' : 'пользователь'));
|
||
location.reload();
|
||
}
|
||
} catch(e) {
|
||
console.error(e);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
|
||
<script>
|
||
$(document).ready(function() {
|
||
|
||
$('.user-profile-toggle').click(function(e) {
|
||
e.stopPropagation();
|
||
$('.user-profile-menu').toggle();
|
||
});
|
||
|
||
$(document).click(function() {
|
||
$('.user-profile-menu').hide();
|
||
});
|
||
|
||
$('.logout-link').click(function(e) {
|
||
if (!confirm('Вы действительно хотите выйти?')) {
|
||
e.preventDefault();
|
||
}
|
||
});
|
||
|
||
updateLoginTime();
|
||
});
|
||
|
||
function updateLoginTime() {
|
||
|
||
}
|
||
</script>
|
||
|
||
<?php if (!isset($_SESSION['isLoggedIn']) || $_SESSION['isLoggedIn'] !== true): ?>
|
||
|
||
<div style="position: fixed; bottom: 20px; right: 20px; z-index: 1000; background: white; padding: 10px; border-radius: 5px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
||
<h4 style="margin: 0 0 10px 0; font-size: 14px; color: #453227;">Быстрый вход:</h4>
|
||
<button onclick="window.location.href='login.php'" style="background: #453227; color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; margin: 5px; width: 100%;">
|
||
<i class="fas fa-sign-in-alt"></i> Войти в аккаунт
|
||
</button>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
</body>
|
||
</html>
|