Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/04/2013, 15:10
ambichol
 
Fecha de Ingreso: febrero-2013
Ubicación: Lima
Mensajes: 301
Antigüedad: 11 años, 2 meses
Puntos: 5
Sonrisa Problemas con Login

hola nuevamente, espero su ayuda ya que no tuve mucha suerte en ocasiones anteriores, esta vez tengo un problema similar al anterior, con un login que no valida el user y el pwd.
les comparto los archivos para ver si me dan una mano...gracias
statusbar-advanced.js
Código Javascript:
Ver original
  1. Ext.QuickTips.init();
  2.  
  3. Ext.onReady(function(){
  4.  
  5.     var fp = new Ext.FormPanel({
  6.         id: 'status-form',
  7.         renderTo: Ext.getBody(),
  8.         labelWidth: 75,
  9.         width: 350,
  10.         buttonAlign: 'right',
  11.         border: false,
  12.         bodyStyle: 'padding:10px 10px 0;',
  13.         defaults: {
  14.             anchor: '95%',
  15.             allowBlank: false,
  16.             selectOnFocus: true,
  17.             msgTarget: 'side'
  18.         },
  19.         items:[{
  20.             xtype: 'textfield',
  21.             fieldLabel: 'Usuario',
  22.             name :'user',
  23.             blankText: 'Ingrese Usuario'
  24.         },{
  25.             xtype: 'textfield',
  26.             fieldLabel: 'Password',
  27.             name: 'password',
  28.             inputType: 'password',
  29.             blankText: 'Ingrese una Clave'
  30.         }],
  31.         buttons: [{
  32.             text: 'Ingresar',
  33.             visible : true,
  34.             handler: function(){
  35.                 if(fp.getForm().isValid()){
  36.                     var sb = Ext.getCmp('form-statusbar');
  37.                     sb.showBusy('Procesando...');
  38.                     fp.getEl().mask();
  39.                     fp.getForm().submit({
  40.                         url: 'fake.php',
  41.                         success: function(){
  42.                             sb.setStatus({
  43.                                 text:'Ingreso al Sistema!',
  44.                                 iconCls:'',
  45.                                 clear: true
  46.                             });
  47.                             fp.getEl().unmask();
  48.                         }
  49.                     });
  50.                 }
  51.             }
  52.         },{
  53.             text :'Cancelar',
  54.             visible : false    
  55.         }]
  56.     });
  57.  
  58.     new Ext.Panel({
  59.         title: 'Acceso al Sistema',
  60.         renderTo: Ext.getBody(),
  61.         width: 350,
  62.         autoHeight: true,
  63.         layout: 'fit',
  64.         items: fp,
  65.         bbar: new Ext.ux.StatusBar({
  66.             id: 'form-statusbar',
  67.             defaultText: 'Ingrese Datos',
  68.             plugins: new Ext.ux.ValidationStatus({form:'status-form'})
  69.         })
  70.     });
  71.  
  72. });

fake.php
Código PHP:
Ver original
  1. <?php
  2. include("../../conexion/cnx.php");
  3. // fake form save
  4. sleep(2);
  5. //obtenemos los valores de nuestro login
  6. $user = $_REQUEST['user'];
  7. $pass = $_REQUEST['password'];
  8. $result = mssql_query("select login,password from SRM_LOGIN where login= '$user' and password = '$pass'");
  9. $row = mssql_fetch_row($result);
  10.  
  11. //preguntamos si es que existe
  12. if($row['user'] != $user && $row['password'] != $pass)
  13. {
  14.  echo "{success: false, errors: { reason: 'Password error.' }}";
  15. }
  16. else{
  17.          echo "{success: true}";
  18.     }
  19. ?>

cnx.php
Código PHP:
Ver original
  1. <?php
  2. $link = mssql_connect('BDS', 'USR', 'PWD') or die("No fue posible conectar con el servidor");
  3. mssql_select_db('DB', $link) or die("No fue posible selecionar la base de datos");
  4.  
  5. //print "Conexión OK!<br>";
  6.  
  7. /*  $sql="select * from srm_login";
  8.     $arr = array();
  9.     $rs = mssql_query($sql) or die;
  10.     while($obj = mssql_fetch_object($rs)){
  11.         $arr[] = $obj;
  12.     }
  13.     Echo json_encode($arr);
  14.  
  15. */
  16. ?>