forked from lydarras/augustine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.php
More file actions
100 lines (90 loc) · 6.39 KB
/
Copy pathuser.php
File metadata and controls
100 lines (90 loc) · 6.39 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
require_once('inc/bdd_conf.php');
require_once('inc/fonctions.php');
if (empty($_SESSION['authlevel']) || $_SESSION['authlevel'] < 3) {
header('Location: index.php');
exit();
}
$users = array();
?>
<?php include_once('inc/header.php'); ?>
<body style="background-color:black;">
<?php include_once('inc/menu.php'); ?>
<?php
// TODO : remettre de l'ordre ci-dessous en supprimant
// les balises center et en utilisant des classes bootstrap twitter
?>
<center>
<table style="width:100%;height:100%;">
<tr>
<td style="border:0px;width:100%;height:100%;">
<center>
<div style="width:500px;border:1px solid white;color:white;">
<center>
<p style="padding:3px;"><strong><big>Utilisateurs (<a href="index.php"><FONT
COLOR="lightgreen">Retour</font></a>)</big></strong></p>
<hr>
<div style="padding:1em;height:auto;width:auto;"><u>Gérer un utilisateur</u><br>
<table style="width:100%;border:0px;">
<?php
foreach ($users as $s) {
// Affichage des utilisateurs.
echo "<tr><form action='user.php?id=" . $s['id'] . "' method='post'>";
echo "<td><div style='border:1px solid white;color:white;background-color:black;width:100%;'><center><small>ID: " . $s['id'] . "</small></center></div></td>";
echo "<td><input type='text' name='username' style='border:1px solid white;color:white;background-color:black;text-align:center;width:100%;' value='" . $s['name'] . "'></td>";
echo "<td><input type='password' name='password' style='border:1px solid white;color:white;background-color:black;text-align:center;width:100%;' value='password'></td>";
echo "<td style='width:0px;'><input type='text' name='authlevel' style='width:25px;border:1px solid white;color:white;background-color:black;text-align:center;' value='" . $s['authlevel'] . "'></td>";
echo "<td><input type='submit' style='border:1px solid white;color:white;background-color:black;width:100%;' value='Modifier'></td>";
if ($s['authlevel'] == 3) {
echo "<td><div style='border:1px solid white;color:white;background-color:black;width:100%;'><center><small>--</small></center></div></td>";
} else {
echo "<td><div style='border:1px solid white;color:white;background-color:black;width:100%;cursor:pointer;' onclick='window.location = \"user.php?user&delete=" . $s['id'] . "\"'><center><small> Supprimer </small></center></div></td>";
}
echo "</form></tr>";
}
?>
</table>
</div>
<br><br>
<div style="padding:1em;height:auto;width:auto;"><u>Créer un utilisateur</u><br>
<?php
$username = getPost('username', 'username');
$pw = getPost('password', 'password');
$authlevel = getPost('authlevel','1');
?>
<form action="doUser.php" method="post">
<table style="width:100%;border:0px;">
<tr>
<td><input type='text' name='username'
style='border:1px solid white;color:white;background-color:black;text-align:center;width:100%;'
value='<?php echo $username; ?>'></td>
<td><input type='text' name='password'
style='border:1px solid white;color:white;background-color:black;text-align:center;width:100%;'
value='<?php echo $pw; ?>'></td>
<td style='width:0px;'><input type='text' name='authlevel'
style='width:25px;border:1px solid white;color:white;background-color:black;text-align:center;'
value='<?php echo $authlevel; ?>'></td>
<td><input type='submit'
style='border:1px solid white;color:white;background-color:black;width:100%;'
value='Créer'></td>
</tr>
</table>
</form>
</div>
</form>
<small>
<p style="text-align:justify;padding:1em;"><u>Notice</u> : Vous ne pouvez modifier
qu'un utilisateur à la fois. Il s'agit d'une interface fragile. N'exécutez
aucune action sans en connaitre les conséquences. Renseignez vous auprès
d'un administrateur.</p>
<u>Authlevel</u><br>1 => Modérateur<br>2 => Administrateur<br>3 =>
Super-Administrateur (1 seul normalement)<br>
</small>
</center>
</div>
</center>
</td>
</tr>
</table>
</center>
</body>