moved things
This commit is contained in:
29
tpCrudTwig/public/add.php
Normal file
29
tpCrudTwig/public/add.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
require_once('../src/User.php');
|
||||
|
||||
if (isset($_POST)) {
|
||||
if (
|
||||
isset($_POST['login']) && !empty($_POST['login'])
|
||||
&& isset($_POST['password']) && !empty($_POST['password'])
|
||||
&& isset($_POST['lastname']) && !empty($_POST['lastname'])
|
||||
&& isset($_POST['firstname']) && !empty($_POST['firstname'])
|
||||
&& isset($_POST['role']) && !empty($_POST['role'])
|
||||
&& isset($_POST['description']) && !empty($_POST['description'])
|
||||
) {
|
||||
$login = strip_tags($_POST['login']);
|
||||
$password = strip_tags($_POST['password']);
|
||||
$lastname = strip_tags($_POST['lastname']);
|
||||
$role = strip_tags($_POST['role']);
|
||||
$firstname = strip_tags($_POST['firstname']);
|
||||
$description = strip_tags($_POST['description']);
|
||||
AddUser($login, $password, $lastname, $role, $firstname, $description);
|
||||
$_SESSION['message'] = "Utilisateur ajouté avec succès !";
|
||||
header('Location: index.php');
|
||||
}
|
||||
}
|
||||
|
||||
$vue = "users/add.twig";
|
||||
$donnees = array();
|
||||
|
||||
require_once('../modele/twig.php');
|
||||
37
tpCrudTwig/public/css/style.css
Normal file
37
tpCrudTwig/public/css/style.css
Normal file
@@ -0,0 +1,37 @@
|
||||
table {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
line-height: 2em;
|
||||
}
|
||||
|
||||
table tr td {
|
||||
border-style: solid;
|
||||
border-color: black;
|
||||
border-width: 0.1em;
|
||||
text-align: center;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: gray;
|
||||
}
|
||||
|
||||
table tr:nth-child(even) {
|
||||
background-color: darkgray;
|
||||
}
|
||||
|
||||
button {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
div {
|
||||
background-color: lightgray;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
8
tpCrudTwig/public/delete.php
Normal file
8
tpCrudTwig/public/delete.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
require_once('../src/User.php');
|
||||
|
||||
if (isset($_GET['id']) && !empty($_GET['id'])) {
|
||||
$id = strip_tags($_GET['id']);
|
||||
DeleteUser($id);
|
||||
header('Location: index.php');
|
||||
}
|
||||
20
tpCrudTwig/public/details.php
Normal file
20
tpCrudTwig/public/details.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
require_once('../src/User.php');
|
||||
|
||||
if (isset($_GET['id']) && !empty($_GET['id'])) {
|
||||
$id = strip_tags($_GET['id']);
|
||||
$user = GetUser($id);
|
||||
if (!$user) {
|
||||
header('Location: index.php');
|
||||
}
|
||||
} else {
|
||||
header('Location: index.php');
|
||||
}
|
||||
|
||||
|
||||
$vue = "users/details.twig";
|
||||
$donnees = array("user" => $user);
|
||||
|
||||
require_once('../modele/twig.php');
|
||||
28
tpCrudTwig/public/edit.php
Normal file
28
tpCrudTwig/public/edit.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
require_once('../src/User.php');
|
||||
|
||||
if (isset($_POST)) {
|
||||
if (
|
||||
isset($_POST['id']) && !empty($_POST['id'])
|
||||
&& isset($_POST['login']) && !empty($_POST['login'])
|
||||
&& isset($_POST['description']) && !empty($_POST['description'])
|
||||
&& isset($_POST['role']) && !empty($_POST['role'])
|
||||
) {
|
||||
$id = strip_tags($_GET['id']);
|
||||
$login = strip_tags($_POST['login']);
|
||||
$description = strip_tags($_POST['description']);
|
||||
$role = strip_tags($_POST['role']);
|
||||
UpdateUser($id, $login, $description, $role);
|
||||
header('Location: index.php');
|
||||
}
|
||||
}
|
||||
if (isset($_GET['id']) && !empty($_GET['id'])) {
|
||||
$id = strip_tags($_GET['id']);
|
||||
$result = GetUser($id);
|
||||
}
|
||||
|
||||
$vue = "users/edit.twig";
|
||||
$donnees = array("user" => $result);
|
||||
|
||||
require_once('../modele/twig.php');
|
||||
9
tpCrudTwig/public/index.php
Normal file
9
tpCrudTwig/public/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// On inclut la connexion à la base
|
||||
require_once('../src/User.php');
|
||||
|
||||
$vue = "users/index.twig";
|
||||
$donnees = array("users" => GetUsers());
|
||||
|
||||
require_once('../modele/twig.php');
|
||||
Reference in New Issue
Block a user