-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
26 lines (25 loc) · 848 Bytes
/
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
<?php
require('controller/frontend_controller.php');
try {
if (isset($_GET['action'])) {
if ($_GET['action'] == 'listMember') {
listMembers();
} elseif ($_GET['action'] == 'addMember') {
if (!empty($_POST['name_member'])) {
if (!is_numeric($_POST['name_member'])) {
addMember(($_POST['name_member']));
} else {
throw new Exception('Ce n\'est pas un nom valide');
}
} else {
// Autre Exception
throw new Exception('Tous les champs ne sont pas remplis !');
}
}
} else {
listMembers();
}
} catch (Exception $e) {
$errorMessage = $e->getMessage();
require('view/frontend/error_view.php');
}