-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
59 lines (54 loc) · 1.92 KB
/
index.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
<!DOCTYPE html>
<html lang="es">
<!-- Aqui esta el login -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <link rel="shortcut icon" href=""> -->
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/bootstrap-theme.css">
<link rel="stylesheet" href="css/login.css">
<title>Bienvenido al sistema</title>
</head>
<body>
<div class="container">
<h1>Bienvenido</h1>
<form id="frm-login">
<h2>Ingresar al sistema</h2>
<input id="accion" name="accion" type="hidden" value="login" />
<input id="usuario" name="usuario" type="text" class="form-control" placeholder="Usuario" />
<input id="contrasena" name="contrasena" type="password" class="form-control" placeholder="Contraseña" />
<button id="boton-login" class="btn btn-primary btn-block" type="button">Entrar</button>
<div id="mensajes" >
</div>
<button id="btn-close" class="btn" type="button" onclick="cerrarSesion()">Cerrar</button>
</form>
</div>
<!-- Empieza javascript -->
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/mustache.js"></script>
<script src="js/util.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#boton-login').bind('click', function() {
var params = $('#frm-login').serializeArray();
$.post('login.php',
params,
function(json) {
if (json.resultado) {
document.location = json.usuario.rol.inicio;
} else {
uxErrorAlert( json.mensaje );
}
});
});
});
function cerrarSesion() {
$.post('login.php',
{accion: 'logout'});
}
</script>
<!-- Termina javascript -->
</body>
</html>