forked from vergnet/site-accueil-insa
acces + font (acces et connexion)
This commit is contained in:
parent
29c6d00b66
commit
7013a85a10
3 changed files with 99 additions and 21 deletions
|
@ -1,8 +1,8 @@
|
||||||
* {
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
--color1 : rgba(30, 30, 30, 1);
|
--color1 : rgb(30, 30, 30);
|
||||||
--color2 : rgba(255, 255, 255, 0.07);
|
--color2 : rgb(46,46,46);
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -61,7 +61,7 @@ table.acces {
|
||||||
table.acces th {
|
table.acces th {
|
||||||
background-color: var(--color2);
|
background-color: var(--color2);
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border: 0;
|
border: 3px solid var(--color2);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
@ -71,3 +71,56 @@ table.acces td {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
text-align: center;
|
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;
|
||||||
|
}
|
|
@ -5,11 +5,35 @@ if($user['perm'] < 2) {
|
||||||
header('Location: deco.php');
|
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['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'])) {
|
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']);
|
$pseudo = htmlspecialchars($_POST['pseudo']);
|
||||||
$mdp = htmlspecialchars($_POST['mdp']);
|
$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) {
|
if(strlen($pseudo) <= 50) {
|
||||||
$req = $db->prepare("SELECT id FROM admin WHERE pseudo = ?");
|
$req = $db->prepare("SELECT id FROM admin WHERE pseudo = ?");
|
||||||
|
@ -17,7 +41,8 @@ if(isset($_POST['send'])) {
|
||||||
$pseudo_exist = $req->rowCount();
|
$pseudo_exist = $req->rowCount();
|
||||||
if ($pseudo_exist == 0) {
|
if ($pseudo_exist == 0) {
|
||||||
$req = $db->prepare("INSERT INTO admin(pseudo, mdp, perm) VALUES(?, ?, ?)");
|
$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 {
|
} else {
|
||||||
$error = "pseudo déja utilisé";
|
$error = "pseudo déja utilisé";
|
||||||
}
|
}
|
||||||
|
@ -39,14 +64,14 @@ if(isset($_POST['send'])) {
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="text" placeholder="identifiant" name="pseudo">
|
<input type="text" placeholder="identifiant" name="pseudo" class="input_inline">
|
||||||
<input type="password" placeholder="mot de passe" name="mdp">
|
<input type="password" placeholder="mot de passe" name="mdp" class="input_inline">
|
||||||
<select name="perm">
|
<select name="perm" class="input_inline">
|
||||||
<option value="0">GDA - Perm 0</option>
|
<option value="v0">GDA - Perm 0</option>
|
||||||
<option value="1">Bureau - Perm 1</option>
|
<option value="v1">Bureau - Perm 1</option>
|
||||||
<option value="2">Admin - Perm 2</option>
|
<option value="v2">Admin - Perm 2</option>
|
||||||
</select>
|
</select>
|
||||||
<input type="submit" name="send" value="Creer l'acces">
|
<input type="submit" name="send" value="Creer l'acces" class="submit_inline">
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
if(isset($error)) {
|
if(isset($error)) {
|
||||||
|
@ -56,10 +81,10 @@ if(isset($_POST['send'])) {
|
||||||
<br><br>
|
<br><br>
|
||||||
<table class="acces">
|
<table class="acces">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="20%">ID (db)</td>
|
<th width="10%">ID (db)</td>
|
||||||
<th width="20%">Identifiant</td>
|
<th width="40%">Identifiant</td>
|
||||||
<th width="20%">Perm</td>
|
<th width="40%">Perm</td>
|
||||||
<th width="40%"></td>
|
<th width="10%">Actions</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$req = $db->query('SELECT id, pseudo, perm FROM admin');
|
$req = $db->query('SELECT id, pseudo, perm FROM admin');
|
||||||
|
@ -69,7 +94,7 @@ if(isset($_POST['send'])) {
|
||||||
<td><?= $admin['id'] ?></td>
|
<td><?= $admin['id'] ?></td>
|
||||||
<td><?= $admin['pseudo'] ?></td>
|
<td><?= $admin['pseudo'] ?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
switch ($user['perm']) {
|
switch ($admin['perm']) {
|
||||||
case 0:
|
case 0:
|
||||||
echo "<font color='green'>GDA</font>";
|
echo "<font color='green'>GDA</font>";
|
||||||
break;
|
break;
|
||||||
|
@ -81,7 +106,7 @@ if(isset($_POST['send'])) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?></td>
|
?></td>
|
||||||
<td></td>
|
<td><a href="?del=<?= $admin['id'] ?>" class="cross">X</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -42,9 +42,9 @@ if(isset($_POST['login'])) {
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="text" placeholder="Identifiant" name="pseudo">
|
<input type="text" placeholder="Identifiant" name="pseudo" class="input">
|
||||||
<input type="password" placeholder="mot de passe" name="password">
|
<input type="password" placeholder="mot de passe" name="password" class="input">
|
||||||
<input type="submit" name="login" value="Se connecter">
|
<input type="submit" name="login" value="Se connecter" class="submit">
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue