153 lines
6.9 KiB
PHP
Executable File
153 lines
6.9 KiB
PHP
Executable File
<?php session_start();
|
|
|
|
$LOGIN_postAreSet = isset($_POST['username']) && isset($_POST['password']); // variables POST existent
|
|
$LOGIN_postStrings = $LOGIN_postAreSet && is_string($_POST['username']) && is_string($_POST['password']); // sont toutes 2 des strings
|
|
$LOGIN_postNotEmpty = $LOGIN_postStrings && strlen($_POST['username']) > 1 && strlen($_POST['password']) > 1; // d'au moins 2 caractères
|
|
|
|
// $_SESSION['username'] = null;
|
|
|
|
// si on a soumis le formulaire
|
|
if( $LOGIN_postNotEmpty ){
|
|
$userlist = file_get_contents('src/userlist.json');
|
|
$userlistObj = json_decode($userlist);
|
|
|
|
if( $userlistObj != null ){ // si format non corrompu
|
|
|
|
if( isset($userlistObj->{$_POST['username']}) ) // si non d'utilisateur connu
|
|
if( $userlistObj->{$_POST['username']}->password == $_POST['password'] ) // si mot de passe ok
|
|
$_SESSION['username'] = $_POST['username'];
|
|
}
|
|
}
|
|
|
|
if( !(isset($_SESSION['username']) && is_string($_SESSION['username']) && strlen($_SESSION['username']) > 1) )
|
|
$_SESSION['username'] = null;
|
|
|
|
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Système d'Information du Département</title>
|
|
|
|
<!-- Informations de la page -->
|
|
<meta charset='utf-8'>
|
|
<meta name='author' content='Aurélien CLERAC; Cédric ELOUNDOU; Guillaume FAUVET; Adrien MARQUES {xdrm}'>
|
|
<meta name='desctiption' content="Système d'Information du Département Informatique" >
|
|
|
|
<!-- Dépendences CSS -->
|
|
<link type='text/css' rel='stylesheet' href='css/layout.css' /> <!-- Positionnement global des pages -->
|
|
<link type='text/css' rel='stylesheet' href='css/header.css' /> <!-- Gestion du header -->
|
|
<link type='text/css' rel='stylesheet' href='css/container.css'/> <!-- Gestion du container -->
|
|
<link type='text/css' rel='stylesheet' href='css/menu.css' /> <!-- Gestion du menu -->
|
|
<link type='text/css' rel='stylesheet' href='css/global.css' /> <!-- Style global -->
|
|
<!-- <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> -->
|
|
|
|
|
|
<!-- Dépendences Javascript -->
|
|
<script type='text/javascript' src='js/shortcut.js' ></script> <!-- Gestion des raccourcis clavier -->
|
|
|
|
</head>
|
|
<body><!-- CORPS DE LA PAGE -->
|
|
|
|
|
|
<div id='WRAPPER'>
|
|
|
|
<!-- MENU DE LA PAGE -->
|
|
<nav id='MENU'>
|
|
<div class='userdata M'>mrd1609a</div>
|
|
<a href='home.php' class='active'>Accueil </a>
|
|
<a href='groups.php' >Groupes </a>
|
|
<a href='ue.php' >Suivi </a>
|
|
<a href='modules.php' >Modules </a>
|
|
<a href='marks.php' >Notes </a>
|
|
<a href='settings.php'>Paramètres </a>
|
|
</nav>
|
|
|
|
<!-- HEADER DE LA PAGE -->
|
|
<div id='HEADER'>
|
|
<div class='notifbar'>
|
|
<div class='member' data-num></div>
|
|
<div class='message'></div>
|
|
<div class='notification'></div>
|
|
</div>
|
|
|
|
<div class='icon'></div>
|
|
<input type='text' placeholder='Type for search' class='searchbar'>
|
|
</div>
|
|
|
|
<div id='SUBHEADER'></div>
|
|
|
|
<!-- CONTENEUR DE LA PAGE -->
|
|
<div id='CONTAINER'>
|
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod <br>
|
|
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo<br>
|
|
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse<br><br><br>
|
|
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non<br>
|
|
proident, sunt <br>in culpa qui officia deserunt mollit anim id est laborum.Lorem ips<br>um dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,<br>
|
|
quis nostrud exercitation ullamco <br>laboris nisi ut aliquip ex ea commodo<br>
|
|
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse<br>
|
|
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non<br>
|
|
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ips<br>um dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,<br>
|
|
quis nostrud exercitation ullamco laboris nisi ut aliq<br>uip ex ea commodo<br><br>
|
|
consequa<br>t. Duis au<br>te irure dolor in reprehenderit in voluptate velit esse<br>
|
|
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non<br>
|
|
proident, sunt in culpa qui<br> officia deserunt <br>mollit anim id est laborum.Lorem ips<br>um dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,<br>
|
|
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo<br>
|
|
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse<br>
|
|
cillum dolore eu fugi<br>at nulla pariatur. Excepteur <br>sint occaecat cupidatat non<br>
|
|
proident, sunt in culpa qui of<br>ficia deserunt mollit anim id est laborum.kireloem<br>
|
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod<br>
|
|
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,<br>
|
|
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo<br>
|
|
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse<br>
|
|
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non<br>
|
|
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<br>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div style='display:none;'>
|
|
<?php
|
|
if( $LOGIN_postAreSet && $_SESSION['username'] == null ){ // si on a soumis un formulaire (mais sans succès)
|
|
echo "<div id='AUTH_FILTER' class='active'></div>";
|
|
echo "<form id='AUTH' action='' method='POST'>";
|
|
echo "<label>Connection</label>";
|
|
echo "<input type='text' name='username' placeholder='Username' value='".$_POST['username']."'>";
|
|
echo "<input type='password' name='password' placeholder='Password' value='".$_POST['password']."'>";
|
|
echo "<span class='errorbox'>  Identifiants incorrects.</span>";
|
|
echo "<input type='submit' value='Connection'>";
|
|
echo "</form>";
|
|
|
|
}else{ // si chargement normal de la page
|
|
|
|
echo "<div id='AUTH_FILTER'></div>";
|
|
echo "<form id='AUTH' action='' method='POST'>";
|
|
echo "<label>Connection</label>";
|
|
echo "<input type='text' name='username' placeholder='Username'>";
|
|
echo "<input type='password' name='password' placeholder='Password'>";
|
|
echo "<span class='errorbox'> </span>";
|
|
echo "<input type='submit' value='Connection'>";
|
|
echo "</form>";
|
|
}
|
|
?></div>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Dépendences Javascript après chargement des éléments -->
|
|
<script type='text/javascript' src='js/actionScript.js'></script>
|
|
|
|
</body>
|
|
</html>
|