-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathregistro.php
More file actions
177 lines (145 loc) · 5.44 KB
/
Copy pathregistro.php
File metadata and controls
177 lines (145 loc) · 5.44 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<html>
<title>Registro</title>
<head>
<!--[if IE 8]>
<link rel="stylesheet" href="style2.css" media="screen"/>
<![endif]-->
<link rel="stylesheet" href="style2.css" media="screen"/>
</head>
<body>
<div id="header"></div>
</br>
</br>
<?php
$terminado=0;
if(isset($_POST['txtNC'])){
$ningunError=true;
//i_t_93@hotmail.com
$patron= "(^((\w)*(([a-z]+[A-Z]+[\d]+)|([A-Z]+[a-z]+[\d]+)|([\d]+[a-z]+[A-Z]+)|([\d]+[A-Z]+[a-z]+))(\w)*))";
$patronNumeros="([\d]+)";
$patronEdad="([\d]{2})";
$numC=$_POST['txtNC'];
$contra=$_POST['txtContraseñaRegistro'];
$usuario=$_POST['txtUsuarioRegistro'];
$paterno=$_POST['txtPaternoRegistro'];
$materno=$_POST['txtMaternoRegistro'];
$edad=$_POST['txtEdad'];
$mail=$_POST['txtMail'];
require 'conexion.php';
if(strlen($usuario)<=1){
echo "<div class = \"registroExitoso\">Tu nombre de usuario es muy corto. D:";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}else
if(strlen($paterno)<=1){
echo "<div class = \"registroExitoso\">Tu apellido paterno es muy corto. D:";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}else
if(strlen($materno)<=1){
echo "<div class = \"registroExitoso\">Tu apellido materno es muy corto. D:";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}else
if(strlen($contra)<8){
echo "<div class = \"registroExitoso\">Tu contraseña es muy corta. Debe contener al menos 8 caracteres.";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}else
if (!preg_match($patron, $contra)) {
echo "<div class = \"registroExitoso\">Tu contraseña no cumple con las normas de seguridad (al menos una mayúscula, una minúscula y un número).";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}else
if(!preg_match($patronNumeros, $numC)){
echo "<div class = \"registroExitoso\">Por favor, utiliza solo números para tu número de control.";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}else
if(strlen($numC)!=8){
echo "<div class = \"registroExitoso\">Tu número de control debe contener 8 números.";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}else
if(!preg_match($patronEdad, $edad)){
echo "<div class = \"registroExitoso\">Por favor, utiliza solo números para tu número de control.";
?>
<a href="registro.php" class="menu_button blue">Volver al formulario.</a>
</div>
<?
$ningunError=false;
}
if($ningunError){
$qry="INSERT INTO usuarios (N_Control, Id_tipo, Id_Esp, Id_Dpto, Pass, Nombre, Paterno, Materno, Edad, Mail) VALUES ($numC, 3, 1, 7,'$contra', '$usuario', '$paterno', '$materno', $edad, '$mail')";
$result=mysqli_query($conexion,$qry) or die(mysqli_error($conexion));
$terminado=1;
}
}else{
?>
<div id="formaRegistro">
<form name="formaRegistro" method="post" action="">
<label id="titles">Número de Control:</label><br />
<input required placeholder="Utiliza solo numeros." maxlength="8" class="loginbox" name="txtNC" type="text" id="txtNumC" pattern="[\d]{8}" />
<br />
<br />
<label id="registro">Nombre: </label><br />
<input class="loginbox" name="txtUsuarioRegistro" pattern="[a-zA-ZñÑ\s]+[a-zA-ZñÑ\s]+" type="text" id="txtUsuarioRegistro" required placeholder="Min 2,Max. 30."/>
<br />
<br />
<label id="registro">Apellido Paterno: </label><br />
<input required placeholder="Max. 30 caracteres." class="loginbox" name="txtPaternoRegistro" type="text" pattern="[a-zA-ZñÑ\s]+[a-zA-ZñÑ\s]+" id="txtPaternoRegistro" />
<br />
<br />
<label id="registro">Apellido Materno: </label><br />
<input required placeholder="Max. 30 caracteres." class="loginbox" name="txtMaternoRegistro" type="text" pattern="[a-zA-ZñÑ\s]+[a-zA-ZñÑ\s]+" id="txtMaternoRegistro" />
<br />
<br />
<label id="titles">Contraseña</label><br />
<input required placeholder="Letras, num, mayusculas." maxlength="18" pattern="(^((\w)*(([a-z]+[A-Z]+[\d]+)|([A-Z]+[a-z]+[\d]+)|([\d]+[a-z]+[A-Z]+)|([\d]+[A-Z]+[a-z]+))(\w)*))" class="loginbox" name="txtContraseñaRegistro" type="password" id="txtContraseñaRegistro" />
<br />
<br />
<label id="titles">Edad:</label><br />
<input required placeholder="Utiliza solo numeros" maxlength="2" class="loginbox" name="txtEdad" type="text" id="txtEd" pattern="[\d]{2}"/>
<br />
<br />
<label id="titles">Mail:</label><br />
<input required placeholder="ej@dominio.com" class="loginbox" name="txtMail" type="email" id="txtMa" pattern="^(.+\@.+\..+)$" />
<br />
<br />
<button type="submit" name="entrar" id="entrar" value="entrar" class="menu_button blue"><span>Registrar</span></button>
</form>
</div>
<?php
}
if($terminado==1){
?>
<div class="registroExitoso">Registro Exitoso </br>
Presiona el boton para regresar al menu de inicio. :)</br>
<a href="index.php" class="menu_button blue">Volver al Inicio.</a>
</div>
<?php
}
?>
</body>
</html>