-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
56 lines (48 loc) · 1.57 KB
/
Copy pathindex.php
File metadata and controls
56 lines (48 loc) · 1.57 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
<?php
require_once 'lib/autoloader.php';
$currentpage = 'Tinder Job';
require_once 'config/config.php';
require 'views/inc/head.php';
include 'views/inc/navbar.php';
//dump($_POST, 'POST');
//dump($_SESSION, 'SESSION');
$ctrl = 'HomeController'; // Valeur par défaut
if (isset($_GET['ctrl'])) {
// Assurez-vous que 'User' est passé dans l'URL
$ctrl = ucfirst(strtolower($_GET['ctrl'])) . 'Controller'; // Cela donnera 'UserController'
}
$method = 'index'; // Valeur par défaut
if (isset($_GET['action'])) {
$method = $_GET['action'];
}
try {
if (class_exists($ctrl)) {
$controller = new $ctrl();
if (!empty($_POST)) {
if (method_exists($controller, $method)) {
if (!empty($_GET['id']) && ctype_digit($_GET['id'])) {
$controller->$method($_GET['id'], $_POST);
} else {
$controller->$method($_POST);
}
}
} else {
if (method_exists($controller, $method)) {
if (!empty($_GET['id']) && ctype_digit($_GET['id'])) {
$controller->$method($_GET['id']);
} else
{
$controller->$method();
}
}
}
} else {
throw new Exception("Le contrôleur '$ctrl' n'existe pas.");
}
if (isset($_GET['action']) && $_GET['action'] == 'validateUser') {
include 'views/job/index.php';
}
} catch (Exception $e) {
throw new Exception('Erreur : ' . $e->getMessage());
}
require 'views/inc/foot.php';