commit
1a3054d22c
@ -0,0 +1,22 @@
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="/pages/gestion/administration.php?page=alias">Alias</a></td>
|
||||
<td><a href="/pages/gestion/administration.php?page=domaines">Domaines</a></td>
|
||||
<td><a href="/pages/gestion/administration.php?page=listes_noires">Listes noires</a></td>
|
||||
<td><a href="/services/utilisateurs/deconnexion.php">Déconnexion</a></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_GET['message']) && !empty($_GET['message'])) {
|
||||
switch ($_GET['message']) {
|
||||
case "bienvenue":
|
||||
echo "<p class=\"messages_retour_ko\">Bienvenue ".$_SESSION['nom_utilisateur'].". Vous êtes authentifié en tant qu'".$_SESSION['privilege_utilisateur'].".</p>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Courtail - Portail des courriels</title>
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/fichiers/css/principal.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/fichiers/css/formulaires.css" />
|
||||
<link rel="icon" href="/fichiers/images/favicon.ico" />
|
||||
</head>
|
||||
<body>
|
@ -0,0 +1,2 @@
|
||||
</body>
|
||||
</html>
|
@ -1,25 +1,3 @@
|
||||
<?php
|
||||
echo "<p>Coucou</p>";
|
||||
$db = new PDO("sqlite:/etc/postfix/postfix.sqlite");
|
||||
$db -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
try {
|
||||
|
||||
$res = $db -> query('SELECT * FROM postfix_alias_vitruels;');
|
||||
|
||||
|
||||
print '<table>';
|
||||
foreach ($res as $row) {
|
||||
|
||||
print '<tr><td>' . $row['courriel'] . '</td><td>' . $row['destination'] . '</td></tr>';
|
||||
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
|
||||
print ("exception " . $e->getMessage());
|
||||
|
||||
}
|
||||
header('Location: /pages/formulaire_accueil.php');
|
||||
?>
|
||||
|
Binary file not shown.
@ -0,0 +1,43 @@
|
||||
<div id="contenu" class="contenu">
|
||||
<div id="contenu_auth">
|
||||
</br>
|
||||
<table id="authentification">
|
||||
<form method="post" action="/services/utilisateurs/identification.php">
|
||||
<tr>
|
||||
<td><label for="identifiant">Votre nom d'utilisateur :</label><br/></td>
|
||||
<td><input type="text" name="identifiant" id="identifiant" required/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="mdp">Votre mot de passe :</label><br/></td>
|
||||
<td><input type="password" name="mdp" id="mdp" required/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input class="envoyer" type="submit" value="envoyer"/></td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
|
||||
if (isset($_GET['erreur']) && !empty($_GET['erreur'])){
|
||||
switch ($_GET['erreur']) {
|
||||
case 1:
|
||||
echo "<p class=\"messages_retour_ko\">Identifiant ou mot de passe incorrecte.</p>";
|
||||
break;
|
||||
case 2:
|
||||
echo "<p class=\"messages_retour_ko\">Vous n'avez pas les privilèges nécessaires.</p>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif (isset($_GET['succes']) && !empty($_GET['succes'])){
|
||||
switch ($_GET['succes']) {
|
||||
case 1:
|
||||
echo "<p class=\"messages_retour_ok\">Vous avez bien été déconnecté.</p>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Page centrale de gestion des fonctionnalités du serveur de courriel.
|
||||
*/
|
||||
session_start();
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/entete.php");
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/barre_menu.php");
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/services/utilisateurs/privileges.php");
|
||||
testPrivileges();
|
||||
|
||||
echo "<pre>";
|
||||
var_dump($_SESSION);
|
||||
echo "</pre>";
|
||||
|
||||
if (isset($_GET['page']) && !empty($_GET['page'])) {
|
||||
switch ($_GET['page']) {
|
||||
case 'alias':
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/services/gestion/alias.php");
|
||||
break;
|
||||
case 'domaines':
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/services/gestion/domaines.php");
|
||||
break;
|
||||
case 'listes_noires':
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/services/gestion/listes_noires.php");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/pied.php");
|
||||
|
||||
?>
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/entete.php");
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/barre_entete.php");
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/pied.php"); ?>
|
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* classe
|
||||
*/
|
||||
class foo
|
||||
{
|
||||
/**
|
||||
* attribut
|
||||
*/
|
||||
function do_foo()
|
||||
{
|
||||
echo "Doing foo.";
|
||||
}
|
||||
|
||||
/**
|
||||
* attribut
|
||||
*/
|
||||
function yohan()
|
||||
{
|
||||
echo "Ce mec est trop fort !";
|
||||
}
|
||||
}
|
||||
|
||||
$bar = new foo;
|
||||
$bar->do_foo();
|
||||
$bar->yohan();
|
||||
|
||||
# classe
|
||||
class Voiture
|
||||
{
|
||||
/**
|
||||
* Déclaration des attributs
|
||||
*/
|
||||
# attributs
|
||||
private $niveau_carburant;
|
||||
private $nombre_portes;
|
||||
private $nombre_roues;
|
||||
|
||||
/**
|
||||
* Cette méthode un peu spéciale est le constructeur, elle est exécutée lorsque vous "créez" votre objet. Elle doit initialiser les attributs de la classe.
|
||||
*/
|
||||
# méthode constructeur
|
||||
public function __construct()
|
||||
{
|
||||
$this->niveau_carburant = 50;
|
||||
$this-> = 3;
|
||||
$this->nombre_roues = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Première méthode accessible par tous et modifiant le niveau de carburant
|
||||
*/
|
||||
# méthode
|
||||
public function modifier_carburant(int $niveau)
|
||||
{
|
||||
$this->niveau_carburant = $niveau;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seconde méthode accessible à tous et modifiant le nombre de portes
|
||||
*/
|
||||
# méthode
|
||||
public function modifier_nb_portes(int $nb_portes)
|
||||
{
|
||||
$this->nombre_portes = $nb_portes;
|
||||
}
|
||||
}
|
||||
|
||||
$voiture = new Voiture;
|
||||
echo "<pre>";
|
||||
var_dump($voiture);
|
||||
echo "</pre>";
|
||||
|
||||
$voiture->modifier_nb_portes(4);
|
||||
|
||||
echo "<pre>";
|
||||
var_dump($voiture);
|
||||
echo "</pre>";
|
||||
|
||||
echo $voiture['nombre_portes'];
|
||||
|
||||
?>
|
||||
# https://www.vulgarisation-informatique.com/php-poo.php
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Connexion à la base SQLite3.
|
||||
*/
|
||||
$base = "/etc/postfix/postfix.sqlite";
|
||||
|
||||
try{
|
||||
$pdo = new PDO("sqlite:$base");
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
catch (Exception $e){
|
||||
die ("Erreur de connexion à la base \"$base\" : ".$e->getMessage()) ;
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,56 @@
|
||||
<div>
|
||||
<h1>Choix utilisateur</h1>
|
||||
<form action="" method="post">
|
||||
<select name="choix_utilisateur" id="">
|
||||
<?php
|
||||
|
||||
require_once ($_SERVER["DOCUMENT_ROOT"]."/services/bdd/connexion.php");
|
||||
try {
|
||||
$req = $pdo->query('SELECT utilisateur FROM postfix_utilisateurs');
|
||||
|
||||
foreach ($req as $utilisateur_bdd => $utilisateur) {
|
||||
if ($utilisateur['utilisateur']==$_SESSION['identifiant_utilisateur']) {
|
||||
echo "<option value=\"".$utilisateur['utilisateur']."\" selected>".$utilisateur['utilisateur']."</option>\n";
|
||||
}
|
||||
elseif ($_SESSION['privilege_utilisateur']=="administrateur") {
|
||||
// !!! Bien faire attention à contrôler la saisie de l'utilisateur sur cette condition !!!
|
||||
echo "<option value=\"".$utilisateur['utilisateur']."\">".$utilisateur['utilisateur']."</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
die ("Erreur de requête de selection utilisateurs pour \"$base\" : ".$e->getMessage());
|
||||
}
|
||||
|
||||
?>
|
||||
<!--<option value="France" selected>France</option>
|
||||
<option value="Belgique">Belgique</option>-->
|
||||
</select>
|
||||
<select name="choix_domaine" id="">
|
||||
<?php
|
||||
|
||||
require_once ($_SERVER["DOCUMENT_ROOT"]."/services/bdd/connexion.php");
|
||||
try {
|
||||
$req = $pdo->query('SELECT domaine FROM postfix_domaines');
|
||||
|
||||
foreach ($req as $domaine_bdd => $domaine) {
|
||||
/*echo "<pre>";
|
||||
var_dump($domaine);
|
||||
echo "</pre>";*/
|
||||
/*if ($domaine['domaine']==$_SESSION['identifiant_utilisateur']) {
|
||||
echo "<option value=\"".$domaine['domaine']."\" selected>".$domaine['domaine']."</option>\n";
|
||||
}*/
|
||||
//elseif ($_SESSION['privilege_utilisateur']=="administrateur") {
|
||||
// !!! Bien faire attention à contrôler la saisie de l'utilisateur sur cette condition !!!
|
||||
echo "<option value=\"".$domaine['domaine']."\">".$domaine['domaine']."</option>\n";
|
||||
//}
|
||||
}
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
die ("Erreur de requête de selection utilisateurs pour \"$base\" : ".$e->getMessage());
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/*
|
||||
session_start();
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/entete.php");
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/barre_entete.php");
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php //require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/pied.php"); ?>
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/*
|
||||
session_start();
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/entete.php");
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/barre_entete.php");
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php //require_once($_SERVER["DOCUMENT_ROOT"]."/inclusions/pied.php"); ?>
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once ($_SERVER["DOCUMENT_ROOT"]."/services/bdd/connexion.php");
|
||||
|
||||
/*
|
||||
*Fonction d'authentification des utilisateurs.
|
||||
*/
|
||||
function validationIdentifiants($pdo,$identifiant,$mdp){
|
||||
try {
|
||||
$req = 'SELECT * FROM postfix_utilisateurs WHERE utilisateur=:identifiant AND mot_de_passe=:mdp';
|
||||
$prep = $pdo->prepare($req);
|
||||
$prep->bindValue(':identifiant', $identifiant);
|
||||
$prep->bindValue(':mdp', $mdp);
|
||||
$prep->execute();
|
||||
|
||||
$result = $prep ->fetchAll(PDO::FETCH_ASSOC);
|
||||
$comptage = count($result);
|
||||
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
die ("Erreur lors du traitement de la requête : " . $e->getMessage());
|
||||
}
|
||||
|
||||
if($comptage == 1){
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Déconnexion d'un utilisateur authentifié.
|
||||
*/
|
||||
// Récupération de la session
|
||||
session_start ();
|
||||
// Destruction des variables de la session
|
||||
session_unset ();
|
||||
// Destruction de la session
|
||||
session_destroy ();
|
||||
// Redirection de l'utilisateur vers la page d'authentifiaction
|
||||
header('location: /pages/formulaire_accueil.php?succes=1');
|
||||
?>
|
@ -0,0 +1,258 @@
|
||||
<?php
|
||||
header ("Refresh: 5;URL=/pages/formulaire_accueil.php?erreur=1");
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>Courtail</title>
|
||||
<!-- Ajouter le favicon <link rel="icon" href="/fichiers/images/favicon.ico" /> -->
|
||||
<style>
|
||||
/* Base */
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: sans-serif;
|
||||
font-size: 40px;
|
||||
color: #FFF;
|
||||
background-color: #1F527D;
|
||||
text-align: center; }
|
||||
|
||||
.chargements{
|
||||
position: absolute;
|
||||
top:40%;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.section {
|
||||
height: 100%;
|
||||
line-height: 100%; }
|
||||
|
||||
.section-2 {
|
||||
}
|
||||
|
||||
.section-3 {
|
||||
background-color: #e74c3c; }
|
||||
|
||||
.section-4 {
|
||||
background-color: #8e44ad; }
|
||||
|
||||
.chargement {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
position: relative; }
|
||||
|
||||
/* chargements */
|
||||
.chargement-quart {
|
||||
border-radius: 50px;
|
||||
border: 6px solid rgba(255, 255, 255, 0.4); }
|
||||
|
||||
.chargement-quart:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: -6px;
|
||||
bottom: -6px;
|
||||
right: -6px;
|
||||
border-radius: 50px;
|
||||
border: 6px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
-webkit-animation: spin 1s linear infinite;
|
||||
-moz-animation: spin 1s linear infinite;
|
||||
animation: spin 1s linear infinite; }
|
||||
|
||||
.chargement-double {
|
||||
border-radius: 50px;
|
||||
border: 6px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
border-bottom-color: #FFF;
|
||||
-webkit-animation: spin 1s linear infinite;
|
||||
-moz-animation: spin 1s linear infinite;
|
||||
animation: spin 1s linear infinite; }
|
||||
.chargement-double:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
bottom: 5px;
|
||||
right: 5px;
|
||||
border-radius: 50px;
|
||||
border: 6px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
border-bottom-color: #FFF;
|
||||
opacity: 0.6;
|
||||
-webkit-animation: spinreverse 2s linear infinite;
|
||||
-moz-animation: spinreverse 2s linear infinite;
|
||||
animation: spinreverse 2s linear infinite; }
|
||||
|
||||
.chargement-cercles {
|
||||
border-radius: 50px;
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
-webkit-animation: spin 1s linear infinite;
|
||||
-moz-animation: spin 1s linear infinite;
|
||||
animation: spin 1s linear infinite; }
|
||||
.chargement-cercles:before, .chargement-cercles:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
left: 5px;
|
||||
bottom: 5px;
|
||||
right: 5px;
|
||||
border-radius: 50px;
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #FFF;
|
||||
opacity: 0.8;
|
||||
-webkit-animation: spin 10s linear infinite;
|
||||
-moz-animation: spin 10s linear infinite;
|
||||
animation: spin 10s linear infinite; }
|
||||
.chargement-cercles:before {
|
||||
top: 12px;
|
||||
left: 12px;
|
||||
bottom: 12px;
|
||||
right: 12px;
|
||||
opacity: .5;
|
||||
-webkit-animation: spin 5s linear infinite;
|
||||
-moz-animation: spin 5s linear infinite;
|
||||
animation: spin 5s linear infinite; }
|
||||
|
||||
.chargement-bares:before, .chargement-bares:after,
|
||||
.chargement-bares span {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0;
|
||||
width: 10px;
|
||||
height: 30px;
|
||||
background-color: #FFF;
|
||||
-webkit-animation: grow 1s linear infinite;
|
||||
-moz-animation: grow 1s linear infinite;
|
||||
animation: grow 1s linear infinite; }
|
||||
.chargement-bares:after {
|
||||
left: 15px;
|
||||
-webkit-animation-delay: -0.66s;
|
||||
-moz-animation-delay: -0.66s;
|
||||
animation-delay: -0.66s; }
|
||||
.chargement-bares span {
|
||||
left: 30px;
|
||||
-webkit-animation-delay: -0.33s;
|
||||
-moz-animation-delay: -0.33s;
|
||||
animation-delay: -0.33s; }
|
||||
|
||||
/* Animations */
|
||||
@-webkit-keyframes spin {
|
||||
from {
|
||||
-webkit-transform: rotate(0deg); }
|
||||
|
||||
to {
|
||||
-webkit-transform: rotate(360deg); } }
|
||||
@-moz-keyframes spin {
|
||||
from {
|
||||
-moz-transform: rotate(0deg); }
|
||||
|
||||
to {
|
||||
-moz-transform: rotate(360deg); } }
|
||||
@keyframes spin {
|
||||
from {
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
-ms-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
transform: rotate(0deg); }
|
||||
|
||||
to {
|
||||
-webkit-transform: rotate(360deg);
|
||||
-moz-transform: rotate(360deg);
|
||||
-ms-transform: rotate(360deg);
|
||||
-o-transform: rotate(360deg);
|
||||
transform: rotate(360deg); } }
|
||||
@-webkit-keyframes spinreverse {
|
||||
from {
|
||||
-webkit-transform: rotate(0deg); }
|
||||
|
||||
to {
|
||||
-webkit-transform: rotate(-360deg); } }
|
||||
@-moz-keyframes spinreverse {
|
||||
from {
|
||||
-moz-transform: rotate(0deg); }
|
||||
|
||||
to {
|
||||
-moz-transform: rotate(-360deg); } }
|
||||
@keyframes spinreverse {
|
||||
from {
|
||||
-webkit-transform: rotate(0deg);
|
||||
-moz-transform: rotate(0deg);
|
||||
-ms-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
transform: rotate(0deg); }
|
||||
|
||||
to {
|
||||
-webkit-transform: rotate(-360deg);
|
||||
-moz-transform: rotate(-360deg);
|
||||
-ms-transform: rotate(-360deg);
|
||||
-o-transform: rotate(-360deg);
|
||||
transform: rotate(-360deg); } }
|
||||
@-webkit-keyframes grow {
|
||||
0% {
|
||||
-webkit-transform: scaleY(0);
|
||||
opacity: 0; }
|
||||
|
||||
50% {
|
||||
-webkit-transform: scaleY(1);
|
||||
opacity: 1; }
|
||||
|
||||
100% {
|
||||
-webkit-transform: scaleY(0);
|
||||
opacity: 0; } }
|
||||
@-moz-keyframes grow {
|
||||
0% {
|
||||
-moz-transform: scaleY(0);
|
||||
opacity: 0; }
|
||||
|
||||
50% {
|
||||
-moz-transform: scaleY(1);
|
||||
opacity: 1; }
|
||||
|
||||
100% {
|
||||
-moz-transform: scaleY(0);
|
||||
opacity: 0; } }
|
||||
@keyframes grow {
|
||||
0% {
|
||||
-webkit-transform: scaleY(0);
|
||||
-moz-transform: scaleY(0);
|
||||
-ms-transform: scaleY(0);
|
||||
-o-transform: scaleY(0);
|
||||
transform: scaleY(0);
|
||||
opacity: 0; }
|
||||
|
||||
50% {
|
||||
-webkit-transform: scaleY(1);
|
||||
-moz-transform: scaleY(1);
|
||||
-ms-transform: scaleY(1);
|
||||
-o-transform: scaleY(1);
|
||||
transform: scaleY(1);
|
||||
opacity: 1; }
|
||||
|
||||
100% {
|
||||
-webkit-transform: scaleY(0);
|
||||
-moz-transform: scaleY(0);
|
||||
-ms-transform: scaleY(0);
|
||||
-o-transform: scaleY(0);
|
||||
transform: scaleY(0);
|
||||
opacity: 0; } }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="chargements">
|
||||
<section class="section section-2">
|
||||
<span class="chargement chargement-double"></span>
|
||||
Traitement...
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
require_once($_SERVER["DOCUMENT_ROOT"]."/services/utilisateurs/authentification.php");
|
||||
|
||||
if (isset($_POST['identifiant']) && isset($_POST['mdp']) && !empty($_POST['identifiant']) && !empty($_POST['mdp'])) {
|
||||
|
||||
/**
|
||||
* Vérification des informations entrées par l'utilisateur.
|
||||
*/
|
||||
$result = validationIdentifiants($pdo,$_POST['identifiant'],$_POST['mdp']);
|
||||
|
||||
if($result) {
|
||||
session_start();
|
||||
$_SESSION['id_utilisateur'] = $result[0]['id'];
|
||||
$_SESSION['identifiant_utilisateur'] = $result[0]['utilisateur'];
|
||||
$_SESSION['nom_utilisateur'] = $result[0]['nom_complet'];
|
||||
$_SESSION['privilege_utilisateur'] = $result[0]['privilege'];
|
||||
|
||||
if (isset($_SESSION['identifiant_utilisateur']) && !empty($_SESSION['identifiant_utilisateur']) && $_SESSION['privilege_utilisateur']=="administrateur") {
|
||||
header ("location: /pages/gestion/administration.php?message=bienvenue&page=alias");
|
||||
die();
|
||||
}
|
||||
elseif (isset($_SESSION['identifiant_utilisateur']) && !empty($_SESSION['identifiant_utilisateur']) && $_SESSION['privilege_utilisateur']=="utilisateur") {
|
||||
header ("location: /pages/gestion/administration.php?message=bienvenue&page=alias");
|
||||
die();
|
||||
}
|
||||
else {
|
||||
echo "Ça ne devrai pas arriver.";
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
header('Location: /services/utilisateurs/echec_auth.php');
|
||||
die();
|
||||
}
|
||||
}
|
||||
else {
|
||||
header('Location: /services/utilisateurs/echec_auth.php');
|
||||
die();
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fonction testant le niveau de privilège d'un utilisateur authentifié ou non.
|
||||
*/
|
||||
function testPrivileges(){
|
||||
if (isset($_SESSION['id_utilisateur']) && !empty($_SESSION['id_utilisateur']) && $_SESSION['privilege_utilisateur']=="administrateur") {
|
||||
|
||||
}
|
||||
elseif (isset($_SESSION['id_utilisateur']) && !empty($_SESSION['id_utilisateur']) && $_SESSION['privilege_utilisateur']=="utilisateur") {
|
||||
|
||||
}
|
||||
else {
|
||||
header("Location: /pages/formulaire_accueil.php?erreur=2");
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,24 @@
|
||||
sqlite3 /etc/postfix/postfix.sqlite
|
||||
|
||||
CREATE TABLE IF NOT EXISTS postfix_utilisateurs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
utilisateur TEXT NOT NULL UNIQUE,
|
||||
mot_de_passe TEXT NOT NULL,
|
||||
nom_complet TEXT,
|
||||
uid INTEGER NOT NULL,
|
||||
gid INTEGER NOT NULL,
|
||||
privilege TEXT NOT NULL,
|
||||
active INTEGER
|
||||
);
|
||||
|
||||
INSERT INTO postfix_utilisateurs (utilisateur,mot_de_passe,nom_complet,uid,gid,privilege,active) VALUES ("toto","toto","Yohan Charbi",5000,5000,"administrateur",1);
|
||||
|
||||
INSERT INTO postfix_utilisateurs (utilisateur,mot_de_passe,nom_complet,uid,gid,privilege, active) VALUES ("tata", "tata", "Nicolos Morin", 5000, 5000, "utilisateur", 1);
|
||||
|
||||
UPDATE postfix_utilisateurs SET nom_complet="Nicolas Morin" WHERE id=2;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS tests (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
utilisateur TEXT NOT NULL UNIQUE,
|
||||
mot_de_passe TEXT NOT NULL
|
||||
);
|
Loading…
Reference in new issue