-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·46 lines (32 loc) · 1.08 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
spl_autoload_register('app_autoload');
function app_autoload($class)
{
require "inc/class/$class.php";
}
require "inc/header.php";
$maSession = Session::getInstance();
if (isset($_GET['action']) && $_GET['action'] == "destruct") {
$maSession->destroy();
header("location: ./index.php");
}
if (isset($_POST['edit_personne']) && !empty($_POST['edit_personne'])) {
$myPdo = new Database();
$user = $myPdo->get_personne($_POST['id_personne']);
$myPdo->edit_personne($user);
}
// 1 - Check si l'utilisateur est loggé
// Si oui : envoyer l'utilisateur sur sa page d'accueil :
if ($maSession->read('auth')) {
if (isset($_SESSION['etudiant']) && !empty($_SESSION['etudiant'])) {
require "inc/page/home_etudiant.php";
}
if (isset($_SESSION['professeur']) && !empty($_SESSION['professeur'])) {
require "./inc/page/home_professeur.php";
}
} else {
// Si non : envoyer l'utilisateur sur la page d'authentification :
require "inc/page/auth.php";
}
require "inc/footer.php";
?>