diff --git a/admin/admin.css b/admin/admin.css
index 5789de4..962b0cf 100644
--- a/admin/admin.css
+++ b/admin/admin.css
@@ -1,8 +1,8 @@
* {
margin: 0;
padding: 0;
- --color1 : rgba(30, 30, 30, 1);
- --color2 : rgba(255, 255, 255, 0.07);
+ --color1 : rgb(30, 30, 30);
+ --color2 : rgb(46,46,46);
}
body {
@@ -61,7 +61,7 @@ table.acces {
table.acces th {
background-color: var(--color2);
padding: 20px;
- border: 0;
+ border: 3px solid var(--color2);
text-align: center;
color: white;
}
@@ -70,4 +70,57 @@ table.acces td {
border: 3px solid var(--color2);
padding: 20px;
text-align: center;
+}
+
+.input {
+ display: block;
+ margin: 30px;
+ padding: 10px;
+ background-color: var(--color1);
+ color: white;
+ border: 3px solid white;
+}
+
+.submit {
+ display: block;
+ padding: 10px;
+ margin: 30px;
+ background-color: var(--color1);
+ color: white;
+ border: 3px solid white;
+}
+
+.submit:hover {
+ transition: 0.2s ease;
+ transform: scale(1.05);
+}
+
+.input_inline {
+ display: inline-block;
+ margin: 10px;
+ padding: 10px;
+ background-color: var(--color1);
+ color: white;
+ border: 3px solid white;
+}
+
+.submit_inline {
+ display: inline-block;
+ padding: 10px;
+ margin: 10px;
+ background-color: var(--color1);
+ color: white;
+ border: 3px solid white;
+}
+
+.submit_inline:hover {
+ display: inline-block;
+ transition: 0.2s ease;
+ transform: scale(1.05);
+}
+
+.cross {
+ text-decoration: none;
+ color: red;
+ font-weight: bold;
}
\ No newline at end of file
diff --git a/admin/gestion_des_acces.php b/admin/gestion_des_acces.php
index f697b89..8cbc936 100644
--- a/admin/gestion_des_acces.php
+++ b/admin/gestion_des_acces.php
@@ -5,11 +5,35 @@ if($user['perm'] < 2) {
header('Location: deco.php');
}
+if(isset($_GET['del']) AND !empty(['del']))
+{
+ if($user['perm'] >= 2) {
+ $del = (int) htmlspecialchars($_GET['del']);
+
+ $req = $db->prepare('DELETE FROM admin WHERE id =?');
+ $req->execute(array($del));
+ header('Location: gestion_des_acces.php');
+ }
+}
+
+
if(isset($_POST['send'])) {
if(isset($_POST['pseudo']) AND !empty($_POST['pseudo']) AND isset($_POST['mdp']) AND !empty($_POST['mdp']) AND isset($_POST['perm']) AND !empty($_POST['perm'])) {
$pseudo = htmlspecialchars($_POST['pseudo']);
$mdp = htmlspecialchars($_POST['mdp']);
- $perm = (int) htmlspecialchars($_POST['perm']);
+ $perm = htmlspecialchars($_POST['perm']);
+
+ switch ($perm) {
+ case "v0":
+ $perm_int = 0;
+ break;
+ case "v1":
+ $perm_int = 1;
+ break;
+ case "v2":
+ $perm_int = 3;
+ break;
+ }
if(strlen($pseudo) <= 50) {
$req = $db->prepare("SELECT id FROM admin WHERE pseudo = ?");
@@ -17,7 +41,8 @@ if(isset($_POST['send'])) {
$pseudo_exist = $req->rowCount();
if ($pseudo_exist == 0) {
$req = $db->prepare("INSERT INTO admin(pseudo, mdp, perm) VALUES(?, ?, ?)");
- $req->execute(array($pseudo, password_hash($mdp, PASSWORD_DEFAULT), $perm));
+ $req->execute(array($pseudo, password_hash($mdp, PASSWORD_DEFAULT), $perm_int));
+ header('refresh:0');
} else {
$error = "pseudo déja utilisé";
}
@@ -39,14 +64,14 @@ if(isset($_POST['send'])) {
- ID (db)
- | Identifiant
- | Perm
- |
+ | ID (db)
+ | Identifiant
+ | Perm
+ | Actions
|
query('SELECT id, pseudo, perm FROM admin');
@@ -69,7 +94,7 @@ if(isset($_POST['send'])) {
= $admin['id'] ?> |
= $admin['pseudo'] ?> |
GDA";
break;
@@ -81,7 +106,7 @@ if(isset($_POST['send'])) {
break;
}
?> |
- |
+ X |
diff --git a/admin/index.php b/admin/index.php
index 3dc48d3..11a21ed 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -42,9 +42,9 @@ if(isset($_POST['login'])) {
} else {
?>