From 219f440b268d966ddb822c80244f9f572c04f185 Mon Sep 17 00:00:00 2001 From: coolneng Date: Wed, 17 Jun 2020 01:02:47 +0200 Subject: [PATCH] Move user creation from to a separate file --- {html => src/html}/header-footer.html | 0 src/html/user_create_form.html | 38 +++++++++++++++ src/user.php | 68 +++++++-------------------- src/user_management.php | 22 ++++++++- static/style.css | 10 ++++ 5 files changed, 87 insertions(+), 51 deletions(-) rename {html => src/html}/header-footer.html (100%) create mode 100644 src/html/user_create_form.html diff --git a/html/header-footer.html b/src/html/header-footer.html similarity index 100% rename from html/header-footer.html rename to src/html/header-footer.html diff --git a/src/html/user_create_form.html b/src/html/user_create_form.html new file mode 100644 index 0000000..6149c8a --- /dev/null +++ b/src/html/user_create_form.html @@ -0,0 +1,38 @@ + + + + Gestión de usuarios + + + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ diff --git a/src/user.php b/src/user.php index 9d3562a..6ad354a 100644 --- a/src/user.php +++ b/src/user.php @@ -9,13 +9,6 @@ - @@ -26,54 +19,29 @@ - - - - - - - - - - + ?> + + + + + + + + +
Acciones
- Editar - - Borrar -
+ Editar + + Borrar +
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
+
+ Crear +
diff --git a/src/user_management.php b/src/user_management.php index 99f540e..da9555b 100644 --- a/src/user_management.php +++ b/src/user_management.php @@ -6,7 +6,18 @@ function userCreation(){ $pdo = connectDatabase("practica", "practica", "practica"); $message = createUser($pdo, $data); closeDatabase($pdo); - $_SESSION['message'] = $message; + header('location: user.php'); +} + +function userModification(){ + $id = $_GET["edit"]; + $pdo = connectDatabase("practica", "practica", "practica"); + header('location: user.php'); +} + +function userDeletion(){ + $id = $_GET["delete"]; + $pdo = connectDatabase("practica", "practica", "practica"); header('location: user.php'); } @@ -14,3 +25,12 @@ function userCreation(){ if (isset($_POST['submit'])) { userCreation(); } + + +if (isset($_GET['edit'])) { + userModification(); +} + +if (isset($_GET['delete'])) { + userDeletion(); +} diff --git a/static/style.css b/static/style.css index 15b106b..b7d88cd 100644 --- a/static/style.css +++ b/static/style.css @@ -54,6 +54,16 @@ form { border: none; border-radius: 5px; } + +.create_btn { + text-decoration: none; + padding: 2px 5px; + background: #88B8E7; + color: white; + border-radius: 3px; + margin: 400px; +} + .edit_btn { text-decoration: none; padding: 2px 5px;