-
Notifications
You must be signed in to change notification settings - Fork 6
/
Registro.php
389 lines (312 loc) · 17.4 KB
/
Registro.php
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<?php
sleep(2);
include 'Auth.php';
if (!empty($_POST['Registrar'])) {
$FDPI = $_POST['form-DPI'];
$FNameF = $_POST['form-nombre'];
$FNameL = $_POST['form-apellido'];
$Genero = $_POST['form-genero'];
$Direccion = $_POST['form-direccion'];
$Departamento = $_POST['form-departamento'];
$Municipio = $_POST['form-municipio'];
$FPassword = $_POST['form-password'];
$FPasswordR = $_POST['form-password2'];
//echo $FNameF."<br>".$FNameL."<br>".$FUserName."<br>".$FEmail."<br>".$FEmailR."<br>".$FPassword."<br>".$FPasswordR ;
if ($FPassword==$FPasswordR) {
$conn = new mysqli($servername,$username,$password,$dbname);
if ($conn->connect_error){
die("Error en la conexion: ".$conn->connect_error);
}
$FPasswordR =md5($FPasswordR);
$sql ="INSERT INTO `sistema1`.`ciudadanos` (`DPI`, `Nombre`, `Apellido`, `Genero`, `Direccion`, `IdDepartamento`, `IdMunicipio`, `Estado`, `Contraseña`) VALUES ('".$FDPI."','".$FNameF."','".$FNameL."','".$Genero."','".$Direccion."','".$Departamento."','".$Municipio."','1','".$FPasswordR."')";
if ($conn->query($sql) === TRUE) {
$mensajeExito = '<div class="alert alert-success" role="alert">El registro fue agregado correctamente</div>';
}
else{
echo "Error: " .$sql."<br>".$conn->error;
$error = '<div class="alert alert-danger" role="alert"><p><strong>No se guardaron los datos </div>';
}
}
else{
$error = '<div class="alert alert-danger" role="alert"><p><strong>Las contraseñas no son iguales </div>';
}
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<!-- Requiered meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=divice-whidth, initial-sace=1, shrink-to-fit=no">
<title>Registro de Votantes</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="FountAuson/css/font-awesome.css">
<link href="https://fonts.googleapis.com/css?family-Ralweay:100,300,400,500">
<link rel="stylesheet" href="css/custom.css">
<link href="css/animate.css" rel="stylesheet" type="text/css" />
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<!-- Scripts -->
<script type="text/javascript">
function mascara(d,sep,pat,nums){
if(d.valant != d.value){
val = d.value
largo = val.length
val = val.split(sep)
val2 = ''
for(r=0;r<val.length;r++){
val2 += val[r]
}
if(nums){
for(z=0;z<val2.length;z++){
if(isNaN(val2.charAt(z))){
letra = new RegExp(val2.charAt(z),"g")
val2 = val2.replace(letra,"")
}
}
}
val = ''
val3 = new Array()
for(s=0; s<pat.length; s++){
val3[s] = val2.substring(0,pat[s])
val2 = val2.substr(pat[s])
}
for(q=0;q<val3.length; q++){
if(q ==0){
val = val3[q]
}
else{
if(val3[q] != ""){
val += sep + val3[q]
}
}
}
d.value = val
d.valant = val
}
}
</script>
<!-- Fin Scripts -->
<!-- Estilos en Css -->
<style>
.slider{
background: url("imagenes/fondo.jpg");
height: 100vh;
background-size: cover;
background-position: center;
}
body{
background: url("imagenes/Antigua.jpg") no-repeat center top;
background-attachment: fixed;
overflow: scroll;
}
.select{
height: 50px;
-moz-appearance: none;
border-radius: 25px !important;
box-shadow: #0E0126 portant;
cursor: pointer;
background: #1D2332;
color: darkgrey;
transition: 0.8s;
border: 3px solid black;
font-size: 14px;
font-weight: 200;
line-height: 50px;
}
.funy {
height: 50px;
background: #1D2332;
color: darkgrey;
transition: 0.8s;
border: 3px solid black;
font-size: 12px;
font-weight: 200;
line-height: 50px;
}
</style>
</head>
<body>
<!--menu de navegacion-->
<nav class="navbar navbar-inverse bg-inverse navbar-toggleable-sm sticky-top formulario">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="index.html">
<img src="imagenes/Logo.svg" width="30" height="30" class="d-inline-block align-top" alt="Logo GDX">
Sistema de Votaciones De Guatemala
</a>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<div class="navbar-nav mr-auto ml-auto text-center">
<a class="nav-item nav-link formulario" href="login.php">Inicio </a>
<a class="nav-item nav-link active formulario" href="Registro.php">Registro </a>
</div>
<div class="d-flex flex-row justify-content-center">
<a href="https://facebook.com/"><span class="badge badge-primary">Facebook</span></a>
<a href="https://youtube.com/"><span class="badge badge-danger">Youtube</span></a>
</div>
</div>
</nav>
<!--Fin Menu de Navegacion-->
<!--Inicia Formulario Login-->
<div> <?php echo $error.$mensajeExito; ?></div>
<div class="my-content formulario formulario">
<div class="container">
<div class="row">
<div class="col-sm-12">
<h1><strong>Elecciones</strong> 2017 </h1>
<div class="mydescription">
<p>Formulario de Registro de Votantes</p>
</div>
</div>
</div>
<div class="row" >
<div class="col-sm-6 offset-3 myform-cont" >
<div class="myform-top">
<div class="myform-top-left">
<h3>Registro Online</h3>
<p>Digita tus datos:</p>
</div>
<div class="myform-top-rigth">
<i class="fa fa-user"> </i>
</div>
</div>
<div class="myform-botton">
<form role="form" action="" method="post" class="">
<div class="form-grup">
<input type="text" name="form-DPI" placeholder="DPI..." class=" form-control" id="form-DPI" minlength="13" onkeyup="mascara(this,'-',patron3,true)">
</div>
<div class="saltito"><h1></h1></div>
<div class="form-grup">
<input type="text" name="form-nombre" placeholder="Nombre..." class="form-control" id="form-nombre">
</div>
<div class="saltito"><h1></h1></div>
<div class="form-grup">
<input type="text" name="form-apellido" placeholder="Apellido..." class="form-control" id="form-apellido">
</div>
<div class="saltito"><h1></h1></div>
<div >
<select class="funy form-control ng-pristine ng-valid ng-valid-required ng-touched" name="form-genero" id="form-genero" ng-model="properties.value" ng-options="ctrl.getValue(option) as (ctrl.getLabel(option) | uiTranslate) for option in properties.availableValues" ng-required="properties.required" ng-disabled="properties.disabled">
<option style="display:none; height:50px;" value="" class="ng-binding">
Genero...
</option>
<option value="Hombre" label="Hombre">Hombre</option>
<option value="Mujer" label="Mujer">Mujer</option>
</select>
</div>
<div class="saltito"><h1></h1></div>
<div class="form-grup">
<input type="text" name="form-direccion" placeholder="Dirección..." class="form-control" id="form-direccion">
</div>
<!-- Departamento -->
<div class="saltito"><h1></h1></div>
<div >
<select class="funy form-control ng-pristine ng-valid ng-valid-required ng-touched" name="form-departamento" id="form-departamento" ng-model="properties.value" ng-options="ctrl.getValue(option) as (ctrl.getLabel(option) | uiTranslate) for option in properties.availableValues" ng-required="properties.required" ng-disabled="properties.disabled">
<option style="display:none; height:50px;" value="" class="ng-binding">
Departamento...
</option>
<?php
$conn = new mysqli($servername,$username,$password,$dbname);
$departamentos = "SELECT * FROM sistema1.departamentos;";
$result = $conn->query($departamentos);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo '<option value="'.$row['codigo'].'">'.utf8_encode($row['nombre']).'</option>';
$CodMunicipio = ['form-departamento'];
}
}
?>
</select>
</div>
<!-- Municipio -->
<div class="saltito"><h1></h1></div>
<div >
<select class="funy form-control ng-pristine ng-valid ng-valid-required ng-touched" name="form-municipio" id="form-mubicipio" ng-model="properties.value" ng-options="ctrl.getValue(option) as (ctrl.getLabel(option) | uiTranslate) for option in properties.availableValues" ng-required="properties.required" ng-disabled="properties.disabled">
<option style="display:none; height:50px;" value="" class="ng-binding">
Municipio...
</option>
<?php
$CodMunicipio = ['form-departamento'];
$conn = new mysqli($servername,$username,$password,$dbname);
$municipios = "SELECT * FROM sistema1.municipio order by nombre;"; //where codigo_depto = ".$CodMunicipio
$result = $conn->query($municipios);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo '<option value="'.$row['codigo'].'">'.utf8_encode($row['nombre']).'</option>';
}
}
?>
</select>
</div>
<div class="saltito"><h1></h1></div>
<div class="form-group">
<input type="password" name="form-password" placeholder="Contaseña..." class="form-control" id="form-password">
</div>
<div class="saltito"><h1></h1></div>
<div class="form-group">
<input type="password" name="form-password2" placeholder="Confirme Contaseña..." class="form-control" id="form-password2">
</div>
<div data-effect="flip" class="effect-button"><input type="submit" name="Registrar" value="Registrar" class="effect-button"></input></div>
<!-- <input type="submit" name="submit" class="mybtn" value="Registrar"></input> -->
</form>
</div>
</div>
</div>
</div>
</div>
<!--Finaliza Formulario LogIn-->
<!-- Inicia Footer-->
<footer class="container-fluid bg-inverse formulario">
<div class="row rext-white py-4 text-white">
<div class="col-md-3">
<img src="imagenes/Logo.svg" alt="" width="50px" height="auto" class="float-left mr-3">
<h4 class="lead"UMG 2017!></h4>
<footer class="blockquote-footer">UMG 2017 <cite title="Source Title" ><br>Desarrollo Web <br>PHP MySQL</cite></footer>
</div>
<div class="col-md-3">
<h4 class="lead">Creditos</h4>
<p>DBA: Guillermo Dieguez<br>BackEnd: David y Guillermo<br>FrontEnd: David Orantes</p>
</div>
<div class="col-md-3">
<h4 class="lead">Creditos</h4>
<p>Documentación: Rafael Velazquez<br>Documentación: Estevan Noriega</p>
</div>
<div class="col-md-3">
<h4 class="lead ">Siguenos</h4>
<a class="mybtn-social" href="https://facebook.com/"><span class="badge badge-primary">Facebook</span></a>
<a class="mybtn-social" href="https://youtube.com/"><span class="badge badge-danger">Youtube</span></a>
</div>
</div>
</footer>
<!-- Finaliza Footer-->
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonimus"></script>
<script src="https://cdnj.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUHKKDx6Qin1DkWx51bBrb" crossorigin="anonimus"></script>
<script src="js/bootstrap.min.js" ></script>
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonimus"></script>
<script src="https://cdnj.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUHKKDx6Qin1DkWx51bBrb" crossorigin="anonimus"></script>
<script src="js/bootstrap.min.js" ></script>
<script src="js/jquery-2.1.0.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/common-script.js"></script>
<script src="js/jquery.slimscroll.min.js"></script>
<script src="js/script.min.js"></script>
<script src="js/animated.js" type="text/javascript"></script>
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-48105801-1', 'creativico.com');
ga('send', 'pageview');
</script>
<script src="js/jPushMenu.js"></script>
<script src="js/side-chats.js"></script>
</body>
</html>