login.js
Código Javascript:
fake.phpVer original
Ext.QuickTips.init(); Ext.onReady(function(){ var fp = new Ext.FormPanel({ id: 'status-form', renderTo: Ext.getBody(), labelWidth: 75, width: 350, buttonAlign: 'right', border: false, bodyStyle: 'padding:10px 10px 0;', defaults: { anchor: '95%', allowBlank: false, selectOnFocus: true, msgTarget: 'side' }, items:[{ xtype: 'textfield', fieldLabel: 'Usuario', name: 'user', blankText: 'Ingrese su Usuario' },{ xtype: 'textfield', fieldLabel: 'Password', name: 'password', inputType: 'password', blankText: 'Ingrese su Clave' }], buttons: [{ text: 'Ingresar', visible: false, handler: function(){ if(fp.getForm().isValid()){ var sb = Ext.getCmp('form-statusbar'); sb.showBusy('Validando...'); fp.getEl().mask(); fp.getForm().submit({ url: 'fake.php', success: function(){ sb.setStatus({ text:'Validacion Completa::::Bienvenido...!', iconCls:'', clear: true }); fp.getEl().unmask(); var redirect = "../../Main/index.php"; window.location = redirect; } }); } } },{ text: 'Cancelar', visible: false }] }); new Ext.Panel({ title: 'Ingrese Datos', renderTo: Ext.getBody(), width: 350, autoHeight: true, layout: 'fit', items: fp, bbar: new Ext.ux.StatusBar({ id: 'form-statusbar', defaultText: 'Ingrese Datos', plugins: new Ext.ux.ValidationStatus({form:'status-form'}) }) }); });
Código PHP:
conexion.phpVer original
<?php include "../conexion.php"; //obtenemos los valores de nuestro login $user = $_REQUEST['user']; $pass = $_REQUEST['password']; //Realiza la validacion de Usuarios if($row['user'] == $user && $row['password'] == $pass) { echo "{success: true}"; }else{ echo "{success: false, errors: { reason: 'Password error.' }}"; } ?>
Código PHP:
Ver original
<?php /*print "Conexión OK!<br>"; $sql="select * from srm_login"; $arr = array(); $rs = mssql_query($sql) or die; while($obj = mssql_fetch_object($rs)){ $arr[] = $obj; } Echo json_encode($arr); */ ?>