sid/index.php

176 lines
5.9 KiB
PHP
Raw Normal View History

2015-10-23 11:08:33 +00:00
<?php define('__ROOT__', dirname(__FILE__) );
require_once __ROOT__.'/manager/security.php';
$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;
/* VARIABLES DES NOTIFICATIONS */
$memberNotifNum = 10;
$messageNotifNum = 0;
$notifNotifNum = 5;
?>
<!DOCTYPE html>
<html>
<head>
2015-10-22 12:05:10 +00:00
<title>Système d'Information du Département Informatique</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 -->
2015-10-22 11:50:56 +00:00
<link type='text/css' rel='stylesheet' href='css/font.css' /> <!-- Positionnement global des pages -->
<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 -->
<!-- Dépendences Javascript -->
<script type='text/javascript' src='API.js' ></script> <!-- Gestion des raccourcis clavier -->
<script type='text/javascript' src='js/pageManager.js' ></script> <!-- Gestion des raccourcis clavier -->
<script type='text/javascript' src='js/shortcut.js' ></script> <!-- Gestion des raccourcis clavier -->
<script type='text/javascript' src='js/dragndrop.js' ></script> <!-- Gestion des raccourcis clavier -->
</head>
<body><!-- CORPS DE LA PAGE -->
<div id='DRAGNDROP'></div>
2015-10-21 08:53:45 +00:00
<div id='WRAPPER'>
2015-10-21 11:22:34 +00:00
2015-10-20 20:10:38 +00:00
<!-- MENU DE LA PAGE -->
<nav id='MENU'>
<?php
if( $_SESSION['username'] != null ) // si $_SESSION['username'] est défini
echo "<div class='userdata M'>".$_SESSION['username']."</div>";
else
echo "<div class='userdata'>Connexion</div>";
?>
2015-10-22 21:06:25 +00:00
<span data-link='home' >Accueil </span>
<span data-link='groups' >Composition</span>
<span data-link='ue' >Suivi </span>
<span data-link='modules' >Modules </span>
<span data-link='marks' >Notes </span>
<span data-link='settings'>Paramètres </span>
2015-10-20 20:10:38 +00:00
</nav>
2015-10-21 11:22:34 +00:00
<!-- HEADER DE LA PAGE -->
<div id='HEADER'>
<div class='notifbar'>
<!-- bouton d'ouverture du formulaire de connection/déconnection -->
<?php
if( $_SESSION['username'] != null ){ // si l'utilisateur est connecté, on affiche les notifications
/* BOUTON DE DECONNECTION */
echo "<div id='LOGOUT' data-info='Déconnection'></div>";
/* NOTIFICATIONS */
/* membres */
// if( $memberNotifNum > 0 ) echo "<div class='member' data-num='".$memberNotifNum."'></div>";
// else echo "<div class='member'></div>";
// messages
// if( $messageNotifNum > 0 ) echo "<div class='message' data-num='".$messageNotifNum."'></div>";
// else echo "<div class='message'></div>";
/* notifications */
if( $notifNotifNum > 0 ) echo "<div class='notification' data-num='".$notifNotifNum."'></div>";
else echo "<div class='notification'></div>";
}else // si l'utilisateur n'est pas connecté on affiche le bouton de CONNECTION
echo "<div id='LOGOUT' data-info='Connexion'></div>";
?>
2015-10-21 11:22:34 +00:00
</div>
<div class='icon'></div>
<input type='text' placeholder='Type for search' class='searchbar'>
</div>
<div id='SUBHEADER'>
2015-10-22 09:33:10 +00:00
<nav>
2015-10-22 09:33:10 +00:00
<!-- <span data-sectname='home' class='active'>Accueil </span>
<span data-sectname='groups'>Groupes </span>
<span data-sectname='case'>Suivi </span>
<span data-sectname='modules'>Modules </span>
<span data-sectname='marks'>Notes </span>
2015-10-22 09:33:10 +00:00
<span data-sectname='settings'>Paramètres </span> -->
</nav>
</div>
2015-10-21 08:53:45 +00:00
<!-- CONTENEUR DE LA PAGE -->
<div id='CONTAINER'></div>
2015-10-21 11:22:34 +00:00
2015-10-21 08:53:45 +00:00
</div>
<div id='AUTH_FILTER'></div>
<?php if( $_SESSION['username'] == null ){ // si on est pas connecté ?>
<form id='AUTH' action='' method='POST'>
<label>Connexion</label>
<input type='text' name='username' placeholder='Username'>
<input type='password' name='password' placeholder='Password'>
<span class='errorbox'>&nbsp</span>
<input type='button' value='Connection'>
</form>
<?php }else{ // si on est connecté ?>
<form id='AUTH' action='' method='POST'>
<label>Déconnection</label>
<input type='button' value='Déconnection'>
</form>
<?php } ?>
2015-10-21 08:53:45 +00:00
<!-- Dépendences Javascript après chargement des éléments -->
<script type='text/javascript' src='js/actionScript.js'></script>
</body>
</html>