Загрузка данных
<div class="auth-card">
<button class="close-btn" onclick="document.referrer ? history.back() : window.location.href='index.php'">×</button>
<div id="view-register" class="auth-view active">
<h2>Регистрация</h2>
<div class="type-toggle">
<button type="button" class="type-btn active" id="btn-private">Частное лицо</button>
<button type="button" class="type-btn" id="btn-company">Компания</button>
</div>
<form action="vendor/signup.php" method="POST" id="reg-form">
<input type="hidden" name="user_type" id="user-type" value="private">
<div class="form-group">
<label id="label-name">ФИО</label>
<input type="text" name="display_name" required placeholder="Введите данные">
</div>
<div class="form-group">
<label>Номер телефона</label>
<input type="tel" name="phone" required placeholder="+7 (___) ___-__-__">
</div>
<div class="form-group">
<label>Электронная почта</label>
<input type="email" name="email" required placeholder="example@axioma.ru">
</div>
<div class="form-group">
<label>Пароль</label>
<input type="password" name="password" id="password" required>
<div class="strength-meter"><div class="strength-bar"></div></div>
</div>
<div class="form-group">
<label>Повторите пароль</label>
<input type="password" name="password_confirm" id="password_confirm" required>
<small id="pass-error" style="color: #ff4b4b; display: none; font-size: 0.75rem; margin-top: 5px;">Пароли не совпадают</small>
</div>
<div class="form-group checkbox-group">
<input type="checkbox" id="terms" required>
<label for="terms">Я согласен с <a href="#">политикой конфиденциальности</a></label>
</div>
<button type="submit" class="reg-button">Создать профиль</button>
</form>
<div class="auth-switch">
<span>Уже есть аккаунт?</span>
<button type="button" class="switch-btn" onclick="toggleAuth('view-login')">Войти</button>
</div>
</div>
<div id="view-login" class="auth-view" style="display: none;">
<h2>Вход</h2>
<form action="vendor/signin.php" method="POST" id="login-form">
<div class="form-group">
<label>Электронная почта</label>
<input type="email" name="email" required placeholder="example@axioma.ru">
</div>
<div class="form-group">
<label>Пароль</label>
<input type="password" name="password" required>
</div>
<button type="submit" class="reg-button">Войти</button>
</form>
<div class="auth-switch">
<span>Нет аккаунта?</span>
<button type="button" class="switch-btn" onclick="toggleAuth('view-register')">Зарегистрироваться</button>
</div>
</div>
</div>
/* Базовые стили для переключаемых видов */
.auth-view {
transition: opacity 0.3s ease, transform 0.3s ease;
opacity: 0;
visibility: hidden;
transform: translateY(10px);
}
/* Активный вид */
.auth-view.active {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
/* Стили для ссылок переключения внизу */
.auth-switch {
margin-top: 20px;
text-align: center;
font-size: 0.9rem;
color: #a0a0a0; /* Подстрой под свою темную тему */
}
.switch-btn {
background: none;
border: none;
color: #ffffff; /* Или твой акцентный цвет Axioma */
font-weight: bold;
cursor: pointer;
padding: 0 5px;
text-decoration: underline;
transition: color 0.2s ease;
}
.switch-btn:hover {
color: #007bff; /* Цвет при наведении */
}
function toggleAuth(targetViewId) {
const views = document.querySelectorAll('.auth-view');
const targetView = document.getElementById(targetViewId);
// Находим текущий активный вид
const currentView = Array.from(views).find(view => view.classList.contains('active'));
if (currentView === targetView) return;
// Скрываем текущий вид (запускаем анимацию исчезновения)
currentView.classList.remove('active');
// Ждем окончания анимации (300ms из CSS) перед сменой display
setTimeout(() => {
currentView.style.display = 'none';
// Подготавливаем новый вид
targetView.style.display = 'block';
// Небольшая задержка, чтобы браузер успел применить display: block перед анимацией
setTimeout(() => {
targetView.classList.add('active');
}, 10);
}, 300);
}
<?php
session_start();
require_once 'db.php';
$email = $_POST['email'];
$password = $_POST['password'];
// Ищем пользователя по почте
$query = mysqli_query($connect, "SELECT * FROM `users` WHERE `email` = '$email'");
if (mysqli_num_rows($query) > 0) {
$user = mysqli_fetch_assoc($query);
// Проверяем совпадение хэша пароля
if (password_verify($password, $user['password'])) {
$_SESSION['user'] = [
"id" => $user['id']
];
header('Location: ../profil.php');
exit();
} else {
die('Неверный логин или пароль');
}
} else {
die('Неверный логин или пароль');
}
?>