If you want more of my pastes visit: https://randompaste.000webhostapp.com/index.html
--------------------------------------------------------------------------------------
<?php
if(!empty($_POST) && !empty($_POST['login']) && !empty($_POST['password'])) {
require_once 'assets/includes.php';
require_once 'assets/functions.php';
$req = $pdo->prepare('SELECT * FROM users WHERE (name = :name OR email = :name) AND confirmed_at IS NOT NULL');
$req->execute(['name' => $_POST['login']]);
$user = $req->fetch();
if(password_verify($_POST['password'], $user->password)) {
session_start();
$_SESSION['auth'] = $user;
$_SESSION['flash']['success'] = 'vous êtes maintenant connecté';
header('Location: account.php');
exit();
} else {
$_SESSION['flash']['danger'] = 'identifiant ou mot de passe incorrecte';
}
}
require 'assets/header.php';
?>
<!DOCTYPE html>
<html lang="en" class="app">
<head>
<meta charset="utf-8" />
</head>
<body class="bg-info dker">
<section id="content" class="m-t-lg wrapper-md animated fadeInUp">
<div class="container aside-xl">
<center><img src="assets/images/logo.png" alt=""></center>
<section class="m-b-lg">
<header class="wrapper text-center">
<strong>Connectez-vous</strong>
</header>
<?php if(isset($_SESSION['flash'])):
foreach($_SESSION['flash'] as $type => $message): ?>
<p>
<center>
<div class="alert alert-<?= $type; ?>">
<?= $message; ?>
</div>
</center>
</p>
<?php
endforeach;
unset($_SESSION['flash']);
endif; ?>
<form action="" method="POST">
<div class="form-group">
<input name="login" type="text" placeholder="Nom d'utilisateur ou adresse email" class="form-control rounded input-lg text-center no-border">
</div>
<div class="form-group">
<input name="password" type="password" placeholder="Mot de passe" class="form-control rounded input-lg text-center no-border">
</div>
<button type="submit" class="btn btn-lg btn-info btn-block rounded">Connexion</button>
<div class="text-center m-t m-b"><a href="reset.php"><small>Mot de passe oublié ?</small></a></div>
<div class="line line-dashed"></div>
<p class="text-muted text-center"><small>Vous n'avez pas encore de compte ?</small></p>
<a href="index.php" class="btn btn-lg btn-info btn-block rounded">Créer un compte</a>
</form>
</section>
</div>
</section>
<?php debug($_SESSION); ?>
<footer id="footer">
<div class="text-center padder">
<p>
<small>Ceets © 2017</small>
</p>
</div>
</footer>
</body>
</html>