<?php
require 'includes/db.php';
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Вход</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<link rel="stylesheet" href="assets/css/log.css">
</head>
<body>
<header class="container-fluid col-xxl-12 row-12">
<div class="header-line ">
<h1> <a href="/"><? echo $config['title']; ?></a></h1>
<form action="get" class="d-xxl-block d-none">
<input type="text">
<button type="submit" class="btn-search">
<i class="bi bi-search"></i>
</button>
</form>
<div class="logins d-xxl-block d-none">
<button class="btn"><a href="login.php">Войти</a></button>
</div>
<? include "includes/collapse.php"?>
</div>
</header>
<form action="get" class="d-xxl-none d-block">
<input type="text" class="input-min">
<button type="submit" class="btn-search-min">
<i class="bi bi-search"></i>
</button>
</form>
<button class="btn btn-primary menu d-xxl-none d-block" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Меню
</button>
<div class="collapse d-xxl-none " id="collapseExample">
<div class="card card-body">
<ul>
<button class="btn-min btn d-xxl-none d-block">Войти</button>
<li><a href="#">Спорт</a> </li>
<li><a href="#">Игры</a></li>
<li><a href="#">Популярное</a> </li>
<li><a href="#">LifeStyle</a> </li>
<li><a href="#">Бизнес</a> </li>
<li><a href="#">Животные</a> </li>
<li><a href="#">Искусство</a></li>
<li><a href="#">Аниме</a> </li>
<li><a href="#">Мода</a> </li>
<li><a href="#">Еда и напитки</a></li>
<li><a href="#">Хобби</a> </li>
<li><a href="#">Программирование</a> </li>
</ul>
</div>
</div>
<?
include 'includes/hub.php'
?>
<?php
$data = $_POST;
if (isset($data['do_log']) )
{
$errors = array();
$user = R::findOne('users', 'login = ?', array($data['login']));
if ($user) {
if (password_verify($data['password'], $user->password) ) {
$_SESSION['logged_user'] = $user;
echo '<div class="err2">Вы Авторизованы!</div>';
}else
{
$errors[] = '<div class="err">Пароль не верный! </div>';
}
} else
{
$errors[] = '<div class="err">Пользователь с таким логином не найден </div>';
}
if ( ! empty($errors) )
{
echo'<div class="err">'.array_shift($errors).'</div>';
}
}
?>
<div class="log container">
<form action="" method="post">
<input type="login" placeholder="Логин" name="login"><br>
<input type="password" placeholder="Пароль" name="password"><br>
<button class="btn" type="submit" name="do_log">Войти</button>
<div class="a container">
<a href="sign_up.php?login=&nickname=&password=&do_signup=">Зарегестрироваться</a><br>
</div>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous"></script>
</body>
</html>