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