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>
|
2015-12-08 22:24:22 +00:00
|
|
|
<title>Connexion</title>
|
2015-12-02 10:44:39 +00:00
|
|
|
|
|
|
|
<meta charset='utf-8'/>
|
|
|
|
<meta name='description' value='Site de test'/>
|
|
|
|
<meta name='author' value='{xdrm} & SeekDaSky'/>
|
|
|
|
|
|
|
|
|
2015-12-13 17:31:08 +00:00
|
|
|
<link rel='stylesheet' href='css/login-material.css'/>
|
2015-12-02 10:44:39 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
2015-12-13 17:31:08 +00:00
|
|
|
<?php
|
2015-12-02 10:44:39 +00:00
|
|
|
|
2015-12-13 17:31:08 +00:00
|
|
|
echo "<form action='#auth' method='POST'>";
|
|
|
|
echo "<input type='text' name='username' id='username' value=''><label for='username'>Username</label>";
|
|
|
|
echo "<input type='password' name='password' id='password' value=''><label for='password'>Password</label>";
|
|
|
|
echo "<input type='submit' name='co' value='Me connecter'>";
|
|
|
|
echo "</form>";
|
2015-12-02 11:32:57 +00:00
|
|
|
|
2015-12-13 17:31:08 +00:00
|
|
|
?>
|
2015-12-02 10:44:39 +00:00
|
|
|
|
2015-12-13 17:31:08 +00:00
|
|
|
<script type='text/javascript'>
|
|
|
|
/* On règle le pb d'accessibilité à l'attribut "value" des inputs
|
|
|
|
* au niveau du CSS
|
|
|
|
*/
|
|
|
|
|
|
|
|
var inputs = document.querySelectorAll('input[type=text], input[type=password]');
|
|
|
|
for( var i = 0 ; i < inputs.length ; i++ )
|
|
|
|
inputs[i].addEventListener('change', function(e){ e.target.setAttribute('value', e.target.value); }, false);
|
|
|
|
</script>
|
2015-12-02 10:44:39 +00:00
|
|
|
</body>
|
2015-12-03 09:02:40 +00:00
|
|
|
</html>
|