2015-12-02 10:44:39 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
2015-12-02 11:32:57 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
petite explication : on démarre le systeme de session de php, on inclu notre authentification
|
|
|
|
, on appelle la fonction que vérifie le login et role de l'utilisateur (voir source pour la doc)
|
|
|
|
si l'utilisateur est logué, on le redirige vers la page d'accueil de l'outil
|
|
|
|
*/
|
|
|
|
session_start();
|
|
|
|
require('autoloader.php');
|
|
|
|
|
|
|
|
if(isset($_POST['co'])){
|
|
|
|
$Auth = new Authentification();
|
|
|
|
$Auth->authentification($_POST['username'],$_POST['password']);
|
2015-12-02 10:44:39 +00:00
|
|
|
}
|
|
|
|
|
2015-12-02 11:32:57 +00:00
|
|
|
if(Authentification::checkUser(0)){
|
|
|
|
header("Location: http://".$_SERVER['HTTP_HOST']."/Dashboard.php");
|
|
|
|
die();
|
|
|
|
};
|
2015-12-02 10:44:39 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Tests php</title>
|
|
|
|
|
|
|
|
<meta charset='utf-8'/>
|
|
|
|
<meta name='description' value='Site de test'/>
|
|
|
|
<meta name='author' value='{xdrm} & SeekDaSky'/>
|
|
|
|
|
|
|
|
|
|
|
|
<link rel='stylesheet' href='globalstylesheet.css'/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
|
|
<?php /* [1] AFFICHAGE DIFFÉRÉ SI CONNECTÉ
|
|
|
|
==============================================*/
|
|
|
|
|
|
|
|
echo "<form action='#auth' method='POST'>";
|
|
|
|
|
|
|
|
/* AFFICHAGE D'ERREURS */
|
|
|
|
if( $postVariablesAreSet ){ // si formulaire soumis
|
|
|
|
if( !$postVariablesNEmpty )
|
|
|
|
echo '<span class=error>Certains champs requis sont vides.</span>';
|
|
|
|
elseif( !$usernameCheck )
|
|
|
|
echo '<span class=error>Nom d\'utilisateur incorrect. (3 car. min)</span>';
|
|
|
|
elseif( !$mailCheck )
|
|
|
|
echo '<span class=error>Adresse mail incorrecte.</span>';
|
|
|
|
elseif( !$passwordCheck )
|
|
|
|
echo '<span class=error>Mot de passe incorrect. (8 car. min)</span>';
|
|
|
|
elseif( connected($user) )
|
|
|
|
echo '<span class=success>Vous êtes connectés.</span>';
|
|
|
|
}
|
|
|
|
|
2015-12-02 11:32:57 +00:00
|
|
|
echo "<input type='text' name='username' placeholder='username'>";
|
|
|
|
echo "<input type='password' name='password' placeholder='password'>";
|
2015-12-02 10:44:39 +00:00
|
|
|
echo "<input type='submit' name='co' value='Me connecter'>";
|
|
|
|
echo "</form>";
|
|
|
|
|
|
|
|
?>
|
2015-12-02 11:32:57 +00:00
|
|
|
|
2015-12-02 10:44:39 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|