Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require "db.php"; ob_start(); ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Дрова 4</title>
- <link rel="stylesheet" href="css/main.min.css">
- </head>
- <body>
- <div class="wrapper">
- <?php include "sidebar.php"; ?>
- <?php
- ob_start();
- $data = $_POST;
- $email = $data['email'];
- $password = $data['password'];
- $hash = password_hash($password, PASSWORD_DEFAULT);
- if ( isset($data['do_auth']) ) {
- $errors = array();
- if ( trim($email) == '' ) {
- $errors[] = "Email введен неверно!";
- }
- if ( $password == '' ) {
- $errors[] = "Пароль введен не правильно!";
- }
- if ( empty($errors) ) {
- $sql = mysqli_query($connection, "SELECT * FROM `users` WHERE `email` = '$email' AND `password` = '$password'");
- $user = mysqli_fetch_assoc($sql);
- if ( mysqli_num_rows($sql) > 0 ) {
- if ( password_verify($password, $user['password']) ) {
- $_SESSION['loggout_user'] = $user['password'];
- echo "Все прошло отлично, вы авторизованы!";
- }
- } else {
- echo "Такого пользователя не найдено!";
- }
- } else {
- echo '<span>'. $errors['0'] . '</span>';
- }
- }
- ?>
- <form method="POST">
- <input type="email" name="email" placeholder="Введите ваш Email!" value="<?php echo $email; ?>">
- <input type="password" name="password" placeholder="Введите ваше пароль!" value="<?php echo $password; ?>">
- <input type="submit" name="do_auth">
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement