Add user creation functionality

This commit is contained in:
coolneng 2020-06-16 18:56:54 +02:00
parent 26cdb78296
commit bb1b2f077b
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 60 additions and 0 deletions

52
html/user.html Normal file
View File

@ -0,0 +1,52 @@
<!doctype html>
<html class="no-js" lang="es">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Gestión de usuarios</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<link rel="stylesheet" href="static/style.css" type="text/css" media="screen" />
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">
You are using an <strong>outdated</strong> browser. Please
<a href="http://browsehappy.com/">upgrade your browser</a> to improve
your experience.
</p>
<![endif]-->
<form method="post" action="../src/user_management.php">
<div class="input-group">
<label>Nombre</label>
<input type="text" name="nombre" value="">
</div>
<div class="input-group">
<label>usuario</label>
<input type="text" name="usuario" value="">
</div>
<div class="input-group">
<label>contraseña</label>
<input type="password" name="contraseña" value="">
</div>
<div class="select-input">
<label>rol</label>
<select id="rol" name="rol">
<option value="1">administrativo</option>
<option value="2">médico</option>
</select>
</div>
<div class="input-group">
<label>correo</label>
<input type="text" name="correo" value="">
</div>
<div class="input-group">
<button class="btn" type="submit" name="submit" >Guardar</button>
</div>
</form>
</body>
</html>

8
src/user_management.php Normal file
View File

@ -0,0 +1,8 @@
<?php
include'database.php';
if (isset($_POST['submit'])) {
$data = $_POST;
$pdo = connectDatabase("practica", "practica", "practica");
createUser($pdo, $data);
closeDatabase($pdo);
}