-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
54 lines (48 loc) · 1.29 KB
/
user.php
File metadata and controls
54 lines (48 loc) · 1.29 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
<?php
require_once 'includes/preload.php';
$controller->check_user();
$page->name = 'user';
$page->title = 'Gestion des utilisateurs';
$object = new User($PDOdb);
if(!empty($id)) $object->fetch($id);
switch ($action) {
case 'update':
$ex_pass = $object->pass_crypted;
$object->set_vars();
if(empty($object->pass_crypted)) $object->pass_crypted = $ex_pass;
case 'create':
$object->set_vars();
$res = $object->save();
if($res) {
header('Location:./user.php');
} else {
echo 'Erreur, veuillez contacter l\'administrateur';
}
exit;
break;
case 'delete':
$res = $object->delete();
if($res) {
header('Location:./user.php');
} else {
echo 'Erreur, veuillez contacter l\'administrateur';
}
exit;
break;
}
// Cas vue interface pour type
include 'tpl/header.tpl.php';
include 'tpl/menu.tpl.php';
switch($action) {
case 'new' :
case 'view' :
case 'edit' :
include 'tpl/user/card.tpl.php';
break;
case 'list':
default :
$TObjects = $object->fetchAll();
include 'tpl/user/list.tpl.php';
break;
}
include 'tpl/footer.tpl.php';