-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
79 lines (70 loc) · 1.65 KB
/
index.php
File metadata and controls
79 lines (70 loc) · 1.65 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
declare(strict_types=1);
session_start();
spl_autoload_register(static function(string $fqcn):void{
$path = preg_replace('/Blog_Art\\\\/','',$fqcn);
$path = str_replace('\\','/',$path).'.php';
require_once($path);
});
use Blog_Art\Controller\FrontendController;
try {
if (isset($_GET['action'])) {
//profile
if ($_GET['action'] == 'profile')
{
if (isset($_SESSION['username'])) {
require('view/front/profile/logout.php');
}else {
require('view/front/profile/login.php');
}
}
//login
elseif ($_GET['action'] == 'login')
{
if (isset($_POST['username']) and isset($_POST['password']) and !empty($_POST['username']) and !empty($_POST['password']))
{
FrontendController::login();
}
else
{
throw new Exception('Veuillez remplir les champs');
}
}
//logout
elseif ($_GET['action'] == 'logout')
{
session_destroy();
unset($_SESSION['username']);
require('view/front/profile/login.php');
}
//show all creations
elseif ($_GET['action'] == 'gallery')
{
FrontendController::showGallery();
}
//show single creation
elseif ($_GET['action'] == 'single')
{
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0)
{
//FrontendController::showCreation($_GET['id']);
echo "string";
}
else
{
throw new Exception('Aucun identifiant envoyé');
}
}
else
{
new FrontendController();
}
}
else
{
new FrontendController();
}
}
catch(Exception $e) {
echo 'Erreur : ' . $e->getMessage();
}