-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUsuario.php
227 lines (202 loc) · 10.7 KB
/
Usuario.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
<?php
include_once 'clases/db_connect.php';
if (isset($_POST['submitted'])) {
/* ------------------------------------BEGIN FILE UPLOADER-------------------------------------------- */
$output_dir = "assets/doc/";
$name_ok;
if (isset($_FILES["myfile"])) {
//Filter the file types , if you want.
if ($_FILES["myfile"]["error"] > 0) {
echo "<p class='error'>Por favor seleccione un archivo</p><br>";
} else {
//move the uploaded file to uploads folder;
$id_unico = uniqid();
move_uploaded_file($_FILES["myfile"]["tmp_name"], $output_dir . $id_unico . $_FILES["myfile"]["name"]);
$name_ok = $output_dir . $id_unico . $_FILES["myfile"]["name"];
foreach ($_POST AS $key => $value) {
$_POST[$key] = mysql_real_escape_string($value);
}
$sql = "INSERT INTO `usuario` ( `subir_u` ) VALUES( '{$_POST['subir_u']}' ) ";
mysql_query($sql) or die(mysql_error());
echo "Registro Agregado.<br />";
echo "<a href='index.php'>Regresar</a>";
}
}
/* ------------------------------------END FILE UPLOADER-------------------------------------------- */
}
?>
<?php
include_once 'clases/db_connect.php';
if (isset($_GET['cod_u']) ) {
$cod_u = (int) $_GET['cod_u'];
if (isset($_POST['submitted']))
{
foreach($_POST AS $key => $value) {
$_POST[$key] = mysql_real_escape_string($value); }
}
$sql = "UPDATE `usuario` SET `nombre_u` = '{$_POST['nombre_u']}' , `apellido_u` = '{$_POST['apellido_u']}' , `fecha_nac_u` = '{$_POST['fecha_nac_u']}' , `direccion_u` = '{$_POST['direccion_u']}' , `telefono_u` = '{$_POST['telefono_u']}' , `email_u` = '{$_POST['email_u']}' , `password_u` = '{$_POST['password_u']}' , `sexo_u` = '{$_POST['sexo_u']}' , `carnet` = '{$_POST['carnet']}' , `fecha_registro` = '{$_POST['fecha_registro']}' , `subir_u` = '{$_POST['subir_u']}' WHERE `cod_u` = '$cod_u' ";
mysql_query($sql) or die(mysql_error());
echo (mysql_affected_rows()) ? "Edited row.<br />" : "Nothing changed. <br />";
echo "<a href='list.php'>Back To Listing</a>";
}
$row = mysql_fetch_array ( mysql_query("SELECT * FROM `usuario` WHERE `cod_u` = '$cod_u' "));
?>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title> Perfil de Usuario </title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="assets/css/datepicker.css">
<link rel="stylesheet" href="assets/css/bootstrap.css">
<link rel="stylesheet" href="assets/css/normalize.css">
<link rel="stylesheet" href="validacionStyle.css">
<script src="assets/js/jquery-v1.10.2.js"></script>
<script src="assets/js/bootstrap-datepicker.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.validate.js"></script>
<script src="assets/js/modernizr2.6.2.js"></script>
<script>
$(document).ready(function() {
$('.datepicker').datepicker();
});
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script>
function numeros(e){
key = e.keyCode || e.which;
tecla = String.fromCharCode(key).toLowerCase();
letras = " 0123456789";
especiales = [8,37,39,46];
tecla_especial = false
for(var i in especiales){
if(key == especiales[i]){
tecla_especial = true;
break;
}
}
if(letras.indexOf(tecla)==-1 && !tecla_especial)
return false;
}
</script>
<script>
function myFunction() {
var pw1 = document.getElementById("pw1").value;
var pw2 = document.getElementById("pw2").value;
var ok = true;
if (pw1 != pw2) {
//alert("Passwords Do not match");
document.getElementById("pw1").style.borderColor = "#E34234";
document.getElementById("pw2").style.borderColor = "#E34234";
ok = false;
}
else {
alert("Passwords Match!!!");
}
return ok;
}
</script>
</head>
<body>
<div id="header" class="navbar navbar-default navbar-static-top">
<?php include_once 'layout/header.php'; ?>
</div>
<div id="contenedor" class="container">
<div class="panel panel-primary">
<div class="panel-heading">Perfil Usuario</div>
<div class="panel-body">
<form action="#" id="perfilusuario" method="POST" class="form-horizontal" onsumbit="return myFunction()">
<div class="form-group">
<label for="Nombre" class="col-lg-3 control-label">Nombre</label>
<div class="col-lg-4">
<input type="text" name="nombre_u" class="form-control" placeholder="Escriba un nombre" required pattern=.{4,25} >
</div>
</div>
<div class="form-group">
<label for="Apellido" class="col-lg-3 control-label">Apellido</label>
<div class="col-lg-4">
<input type="text" name="apellido_u" class="form-control" placeholder="Escriba un apellido" required pattern=.{4,25}>
</div>
</div>
<div class="form-group">
<label for="motivo" class="col-lg-3 control-label" >Fecha Nacimiento</label>
<div class="col-lg-3">
<input type="text" name="fecha_nac_u" class="form-control datepicker" min="1963-01-01" max="1996-01-01" placeholder="Introduzca una fecha" required onkeypress="return isNumberKey(this)">
</div>
</div>
<div class="form-group">
<label for="Direccion" class="col-lg-3 control-label">Direccion</label>
<div class="col-lg-4">
<input type="text" name="direccion_u" placeholder="Escriba su Direccion" class="form-control" required pattern=".{25,250}">
</div>
</div>
<div class="form-group">
<label for="Telefono_Contacto" class="col-lg-3 control-label"> Telefono de Contacto </label>
<div class="col-lg-4">
<input type="tel" name="telefono_u" class="form-control" required pattern=".{8,11}" onkeypress="return numeros(event)" >
</div>
</div>
<div class="form-group">
<label for="Email" class="col-lg-3 control-label">Correo</label>
<div class="col-lg-4">
<input type="email" name="email_u" class="form-control" placeholder="Escriba un correo aqui" required>
</div>
</div>
<div class="form-group">
<label for="carnet" class="col-lg-3 control-label">Carnet</label>
<div class="col-lg-4">
<input type="tex" name="carnet" class="form-control" required pattern=".{8,9}" placeholder="Escriba un correo aqui" required>
</div>
</div>
<div class="form-group">
<label for="password" class="col-lg-3 control-label">Password</label>
<div class="col-lg-4">
<input id="pw1" type="password" name="password_u" class="form-control" placeholder="Escriba una contrasenia" autocomplete="off" required pattern=.{8,25}>
</div>
</div>
<div class="form-group">
<label for="password" class="col-lg-3 control-label">Confirmar Password</label>
<div class="col-lg-4">
<input id="pw2" type="password" name="password2" class="form-control" placeholder="Confirmar Password" autocomplete="off" required pattern=.{8,25}>
</div>
</div>
<div class="form-group">
<label for="sexo" class="col-lg-3 control-label">Genero</label>
<div class="col-lg-4">
<select name="sexo_u" class="form-control" required>
<option value="">Seleccione una opcion: </option>
<option value="M">Masculino</option>
<option value="F">Femenino</option>
</select>
</div>
</div>
<br>
<div class="form-group">
<label class="col-lg-2 control-label">Subir curriculum </label>
<div class="col-lg-3">
<input type="file" id="exampleInputFile" name="subir_u">
<p class="help-block"></p>
</div>
</div>
<br>
<center><div><input type='submit' class="btn btn-primary btn-lg" value='Guardar' /><input type='hidden' value='1' name='submitted' /></div></center>
</form>
</div>
</div>
</div>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
</body>
</html>