-
Notifications
You must be signed in to change notification settings - Fork 0
/
guardarEUsuario.php
111 lines (100 loc) · 4.12 KB
/
guardarEUsuario.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
<?php
include("sources/funciones.php");
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_POST) {
$id = $_POST['id'];
$usu = __(strtolower($_POST["usu"]));
$cambiarPass = $_POST['cambiarPass'];
if ($cambiarPass == "si") {
$pass = __($_POST["pass"]);
$passEncriptado = sha1($pass);
}
require("sources/Query.inc");
$query = new Query();
if ($cambiarPass == "si") {
if ($query->update("login", "usuario='$usu', password='$passEncriptado'", "idLogin=$id")) {
$respuesta = '
<img src="images/ok.png" width="100">
<h4>
Datos actualizados correctamente.
</h4>
';
} else {
$respuesta = '
<img src="images/error.png" width="100">
<h4>
Ha ocurrido un error.
</h4>
';
}
}else{
if ($query->update("login", "usuario='$usu'", "idLogin=$id")) {
$respuesta = '
<img src="images/ok.png" width="100">
<h4>
Datos actualizados correctamente.
</h4>
';
} else {
$respuesta = '
<img src="images/error.png" width="100">
<h4>
Ha ocurrido un error.
</h4>
';
}
}
?>
<!DOCTYPE html>
<html>
<head>
<?php include ('sources/template/head.php'); ?>
<meta http-equiv="Refresh" content="2;url=consultarUsuario.php" />
</head>
<body class="skin-black-light sidebar-mini sidebar-collapse">
<!-- Site wrapper -->
<div class="wrapper">
<header class="main-header">
<?php include ('sources/template/header.php'); ?>
</header>
<!-- =============================================== -->
<!--aquí no hay menú-->
<!-- =============================================== -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<?php include ('sources/template/titulo.php'); ?>
<!-- Main content -->
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-6 col-md-offset-3">
<!-- Default box -->
<div class="box box-solid box-default">
<div class="box-header with-border">
<h3 class="box-title">Editar Usuario</h3>
</div>
<div class="box-body text-center">
<?php echo $respuesta; ?>
</div><!-- /.box-body -->
<div class="box-footer text-center">
<h4>
<small>Redireccionando...</small>
</h4>
<img src="images/cargando.gif" width="20">
<br>
</div><!-- /.box-footer-->
</div><!-- /.box -->
</div>
</div>
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<?php include ('sources/template/pie.php'); ?>
</div><!-- ./wrapper -->
<?php include ('sources/template/scripts.php'); ?>
</body>
</html>
<?php
} else {
redireccionar();
}
?>