diff --git a/crud/add.php b/crud/add.php new file mode 100644 index 0000000..661f090 --- /dev/null +++ b/crud/add.php @@ -0,0 +1,61 @@ +prepare($sql); + $query->bindValue(':login', $login, PDO::PARAM_STR); + $query->bindValue(':password', $password, PDO::PARAM_STR); + $query->bindValue(':firstname', $firstname, PDO::PARAM_STR); + $query->bindValue(':lastname', $lastname, PDO::PARAM_STR); + $query->bindValue(':description', $description, PDO::PARAM_STR); + $query->bindValue(':role', $role, PDO::PARAM_INT); + $query->bindValue(':enabled', 1, PDO::PARAM_INT); + $query->execute(); + $_SESSION['message'] = "Utilisateur ajouté avec succès !"; + header('Location: index.php'); + } +} +require_once('close.php'); +?> + + + + +
+ +ID : = $user['id'] ?>
+Login : = $user['login'] ?>
+FirstName : = $user['firstname'] ?>
+LastName : = $user['lastname'] ?>
+Role : = $user['role'] ?>
+ + + + \ No newline at end of file diff --git a/crud/edit.php b/crud/edit.php new file mode 100644 index 0000000..a21ce6b --- /dev/null +++ b/crud/edit.php @@ -0,0 +1,73 @@ +prepare($sql); + $query->bindValue(':login', $login, PDO::PARAM_STR); + $query->bindValue(':description', $description, PDO::PARAM_STR); + $query->bindValue(':role', $role, PDO::PARAM_INT); + $query->bindValue(':id', $id, PDO::PARAM_INT); + $query->execute(); + header('Location: index.php'); + } +} +if (isset($_GET['id']) && !empty($_GET['id'])) { + $id = strip_tags($_GET['id']); + $sql = "SELECT * FROM `users` WHERE `id`=:id;"; + $query = $db->prepare($sql); + $query->bindValue(':id', $id, PDO::PARAM_INT); + $query->execute(); + $result = $query->fetch(); +} +require_once('close.php'); +?> + + + + + + +| ID | +Login | +Nom | +Prenom | +Rôle | + + + +|
|---|---|---|---|---|---|
| = $user['id'] ?> | += $user['login'] ?> | += $user['firstname'] ?> | += $user['lastname'] ?> | += $user['role'] ?> | +Voir Modifier Supprimer | +