Création de l'authentification (en cours)

This commit is contained in:
xdrm-brackets 2015-10-20 23:03:24 +02:00
parent e9a025a5e0
commit 153e4f23a5
3 changed files with 28 additions and 8 deletions

View File

@ -125,8 +125,15 @@ body{
/*display: block;*/ display: none; /*display: block;*/ display: none;
position: fixed; position: fixed;
top: 30%; top: 30%;
left: calc( 50% - 500px/2 ); left: calc( 50% - 250px/2 );
width: 500px; width: 250px;
/* foreground */
color: #fff;
font-weight: bold;
text-transform: uppercase;
line-height: 3em;
text-shadow: 1px 1px 0 #666;
/* z axis */ /* z axis */
z-index: 101; z-index: 101;
@ -140,8 +147,8 @@ body{
display: block; display: block;
position: relative; position: relative;
top: 0; top: 0;
left: 25%; left: 0;
width: calc( 50% - 2*.8em ); width: calc( 100% - 2*.8em );
margin-bottom: 2em; margin-bottom: 2em;
padding: .8em; padding: .8em;
@ -169,7 +176,7 @@ body{
/* SUBMIT */ /* SUBMIT */
#AUTH input[type=submit]{ #AUTH input[type=submit]{
/* position */ /* position */
width: 50%; width: 100%;
/* foreground */ /* foreground */
color: #fff; color: #fff;

View File

@ -1,6 +1,12 @@
<?php <?php session_start();
$postAreSet = isset($_POST['username']) && isset($_POST['password']); // variables POST existent
$postStrings = $postAreSet && is_string($_POST['username']) && is_string($_POST['password']); // sont toutes 2 des strings
$postNotEmpty = $postStrings && strlen($_POST['username']) > 1 && strlen($_POST['password']) > 1; // d'au moins 2 caractères
if( $postNotEmpty ){
$userlist = file_get_contents('src/userlist.json');
}
// $_SERVER['HTTP_USER_AGENT']; // dépends du navigateur (version, système X, OS) // $_SERVER['HTTP_USER_AGENT']; // dépends du navigateur (version, système X, OS)
// $_SERVER['REMOTE_ADDR']; // ip publique de l'utilisateur // $_SERVER['REMOTE_ADDR']; // ip publique de l'utilisateur
@ -51,13 +57,19 @@
<a href='settings.php'>Paramètres </a> <a href='settings.php'>Paramètres </a>
</nav> </nav>
<a>Authentification</a> <?php
if( isset($_SESSION['username']) && strlen($_SESSION['username']) > 1 )
echo '<a>'.$_SESSION['username'].'</a>';
else
echo "<a class='active'>Authentificaiton</a>";
?>
</div> </div>
<div id='AUTH_FILTER'></div> <div id='AUTH_FILTER'></div>
<form id='AUTH' action='' method='POST'> <form id='AUTH' action='' method='POST'>
Connection
<input type='text' name='username' placeholder='username'> <input type='text' name='username' placeholder='username'>
<input type='password' name='password' placeholder='password'> <input type='password' name='password' placeholder='password'>
<input type='submit' value='Connection'> <input type='submit' value='Connection'>

View File

@ -11,6 +11,7 @@ var DOM = {
/* GESTION DE L'AFFICHAGE DU LOGIN */ /* GESTION DE L'AFFICHAGE DU LOGIN */
DOM.authBtn.addEventListener('click', function(e){ // clic sur "Authentification" DOM.authBtn.addEventListener('click', function(e){ // clic sur "Authentification"
e.preventDefault(); // désactive l'action par défaut e.preventDefault(); // désactive l'action par défaut
if( e.target.className == 'active' )
DOM.loginFltr.className = 'active'; DOM.loginFltr.className = 'active';
}, false); }, false);