-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvistaAltaVotante.php
More file actions
133 lines (114 loc) · 4.32 KB
/
Copy pathvistaAltaVotante.php
File metadata and controls
133 lines (114 loc) · 4.32 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Alta Votantes</title>
<?php session_start();
include 'Extras/css.php'; ?>
</head>
<body>
<?php include 'Extras/menu.php'; ?>
<div class="container-contact100">
<div class="wrap-contact100">
<form class="contact100-form validate-form" action="controladorAltaVotantes.php" method="POST"
onsubmit="return dobValidate('dn','date')">
<span class="contact100-form-title">
Alta Votantes
</span>
<div class="wrap-input100 validate-input" data-validate="Pon tu DNI">
<input maxlength="9" minlength="9" class="input100" type="text" name="dni" placeholder="DNI" id="lul"
required="">
<span class="focus-input100"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Pon tu Nombre">
<input class="input100" type="text" name="nombre" placeholder="Nombre" style="text-transform: capitalize;"
required="">
<span class="focus-input100"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Pon tus Apellidos">
<input class="input100" type="text" name="apellidos" placeholder="Apellidos"
style="text-transform: capitalize;" required="">
<span class="focus-input100"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Pon tu Fecha de Nacimiento">
<input class="input100" type="date" name="fechaN" id="fecha" required="">
<span class="focus-input100"></span>
</div>
<script>
function dobValidate(dni, birth) {
var dni = document.getElementById('lul').value;
numero = dni.substr(0, dni.length - 1);
let = dni.substr(dni.length - 1, 1);
numero = numero % 23;
letra = 'TRWAGMYFPDXBNJZSQVHLCKET';
letra = letra.substring(numero, numero + 1);
if (letra != let) {
alert("Dni inválido");
return false;
}
var today = new Date();
var nowyear = today.getFullYear();
var nowmonth = today.getMonth();
var nowday = today.getDate();
var b = document.getElementById('fecha').value;
var birth = new Date(b);
var birthyear = birth.getFullYear();
var birthmonth = birth.getMonth();
var birthday = birth.getDate();
var age = nowyear - birthyear;
var age_month = nowmonth - birthmonth;
var age_day = nowday - birthday;
if (age > 150) {
alert("Introduce un fecha vádila. No puede ser mas de 150 años.")
return false;
}
if (age_month < 0 || (age_month == 0 && age_day < 0))
age = parseInt(age) - 1;
if ((age == 18 && age_month <= 0 && age_day <= 0) || age < 18) {
alert("Debes tener más de 18 años para votar");
return false;
}
}
</script>
<div class="wrap-input100 validate-input" data-validate="Pon tu Domicilio">
<input class="input100" type="text" name="domicilio" placeholder="Domicilio" required="">
<span class="focus-input100"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Pon tu Contraseña">
<input class="input100" type="password" name="contraseña" placeholder="Contraseña" id="password" required="">
<span class="focus-input100"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Repite la Contraseña">
<input class="input100" type="password" name="contraseña2" placeholder="Repite Contraseña"
id="password_confirm" required="" oninput="check(this)">
<script language='javascript' type='text/javascript'>
function check(inpu) {
if (inpu.value != document.getElementById('password').value)
inpu.setCustomValidity('Las contraseñas no coinciden.');
else
inpu.setCustomValidity('');
}
</script>
<span class="focus-input100"></span>
</div>
<div class="container-contact100-form-btn">
<button type="submit" class="contact100-form-btn">
<span>
<i class="fa fa-paper-plane-o m-r-6" aria-hidden="true"></i>
Confirmar
</span>
</button>
</div>
</form>
</div>
</div>
<div>
<br>
<div class="center-column">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<a href="menuEntrada.php" class="btn btn-success">Atras</a>
</div>
</div>
<div id="dropDownSelect1"></div>
<?php include 'Extras/scripts.php' ?>
</body>
</html>