forked from cabolanoz/SMSEmpresa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·111 lines (107 loc) · 6.01 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
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
<!DOCTYPE html>
<?php
/**
* @author: César Bolaños [cbolanos]
*/
session_start();
if (isset($_SESSION['user']) && isset($_SESSION['password'])) {
header('Location: ./pages/dashboard.php');
exit();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script src="js/ext-all.js" type="text/javascript"></script>
<link href="js/resources/css/ext-all.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<br>
<br>
<br>
<br>
<br>
<br>
<div align="center">
<table>
<tr>
<td align="center">
<form action="" id="login" method="post" name="login">
<div align="center" id="loginform">
<script type="text/javascript">
Ext.onReady(function() {
Ext.QuickTips.init();
var loginform = Ext.create('Ext.form.Panel', {
bodyStyle: 'padding:5px 5px 0',
frame: true,
method: 'GET',
title: 'Inicio de Sesión',
url: 'phpcode/login.php',
width: 350,
fieldDefaults: {
msgTarget: 'side',
labelWidth: 120
},
defaultType: 'textfield',
defaults: {
anchor: '100%'
},
items: [{
allowBlank: false,
blankText: 'Este campo es requerido',
fieldLabel: 'Nombre de Usuario',
id: 'user',
name: 'user'
},{
allowBlank: false,
blankText: 'Este campo es requerido',
fieldLabel: 'Contraseña',
id: 'password',
inputType: 'password',
name: 'password'
}],
buttons: [{
text: 'Acceder',
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
var user = Ext.getCmp('user');
var password = Ext.getCmp('password');
if (user.isValid() && password.isValid()) {
form.submit({
params: {
user: user.getValue(),
password: password.getValue()
},
failure: function(form, action) {
Ext.Msg.alert('Envío de Mensajes', 'Usuario y/o contraseña incorrectos');
},
success: function(form, action) {
window.location.href = './pages/dashboard.php';
}
});
} else {
user.reset();
password.reset();
}
}
}
},{
text: 'Cancelar',
handler: function() {
this.up('form').getForm().reset();
}
}]
});
loginform.render('loginform');
});
</script>
</div>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>