-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregistro.php
More file actions
129 lines (129 loc) · 5.93 KB
/
registro.php
File metadata and controls
129 lines (129 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
session_start();
if(isset($_SESSION["id"])){
header('Location: index.php');
}
require ('connection.php');
if(isset($_POST["nombre"])){
$nombre = $_POST["nombre"];
$apellidos = $_POST["apellidos"];
$fechaNacimiento = $_POST["fechaNac"];
$correo = $_POST["correo"];
$pass = md5($_POST["password"]);
$query = "INSERT INTO usuarios(nombre,apellidos,fecha_nacimiento,correo,contrasena) VALUES ('$nombre','$apellidos','$fechaNacimiento','$correo','$pass')";
$connection=connect();
$result=$connection->query($query);
if($result){
disconnect($connection);
echo '<script>window.alert("Usuario Registrado Correctamente");window.location.href = "index.php";</script>';
} else {
disconnect($connection);
echo '<script>window.alert("Usuario No Registrado Correctamente");window.location.href = "index.php";</script>';
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="logo.png">
<title>Registro</title></head>
<body>
<nav class="navbar navbar-expand-lg static-top navbar-dark" style="background-color:rgb(52, 13, 95);">
<div class="container">
<a class="navbar-brand" href="index.php">
<img src="logo.png" alt="Logo" srcset="">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ms-auto">
<li class="nav-item active">
<a class="nav-link" href="index.php">Inicio</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="anuncios.php">Proveedores</a>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php">Iniciar Sesión</a>
</li>
<li class="nav-item dropdown">
<a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown">Registrarse</a>
<div class="dropdown-menu dropdown-menu-end">
<a class="dropdown-item" href="registro.php">Registro Usuario</a>
<a class="dropdown-item" href="registroProveedor.php">Registro Proveedor</a>
</div>
</li>
</ul>
</div>
</div>
</nav>
<br>
<h1 style="text-align: center;">¡Registrese Aquí!</h1>
<br>
<div style="margin-left: auto;margin-right: auto;" class="col-md-7 col-lg-5 col-xl-5 offset-xl-1">
<form id="myForm" method="POST" action="">
<div class="form-outline mb-4">
<label class="form-label" for="nombre">Nombre</label>
<input name="nombre" type="text" id="nombre" class="form-control form-control-lg" placeholder="Nombre"/>
</div>
<div class="form-outline mb-4">
<label class="form-label" for="apellidos">Apellidos</label>
<input name="apellidos" type="text" id="apellidos" class="form-control form-control-lg" placeholder="Apellidos"/>
</div>
<div class="form-outline mb-4">
<label class="form-label" for="password">Fecha de Nacimiento</label>
<input class="form-control" type="date" id="fechaNac" name="fechaNac">
</div>
<div class="form-outline mb-4">
<label class="form-label" for="correo">Correo</label>
<input name="correo" type="email" id="email" class="form-control form-control-lg" placeholder="Correo"/>
</div>
<div class="form-outline mb-4">
<label class="form-label" for="password">Contraseña</label>
<input name="password" type="password" id="password" class="form-control form-control-lg" placeholder="Contraseña" />
</div>
<div class="form-outline mb-4">
<label class="form-label" for="password">Confirmar Contraseña</label>
<input name="password" type="password" id="confirmar-password" class="form-control form-control-lg" placeholder="Confirmar Contraseña" />
</div>
<p style="text-align: center;">
<button id="boton" type="button" class="btn btn-primary btn-lg btn-block">Sign up</button>
</p>
</form>
</div>
<br><br>
<footer class="footer">
<br><br>
Comparte La Fiesta © 2021 Copyright
<br>
Ubicación: Aguascalientes, México
</footer>
<!--Bootstrap y jQuery JS-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<script>
document.getElementById("boton").addEventListener("click",()=>{
let nombre =document.getElementById("nombre");
let apellidos =document.getElementById("apellidos");
let fecNac =document.getElementById("fechaNac");
let email =document.getElementById("email");
let p1 = document.getElementById("password");
let p2 = document.getElementById("confirmar-password");
let condicion = !(nombre.value.length > 0 && apellidos.value.length > 0 && fecNac.value.length > 0 && email.value.length > 0 && p1.value.length > 0 && p2.value.length > 0);
if(condicion){
window.alert("Hay campos vacios");
}else if(p1.value != p2.value){
window.alert("Las contraseñas no coinciden");
} else {
document.getElementById("myForm").submit();
}
});
</script>
</body>
</html>