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

Estimados,

que tal, tengo un problema con respecto a un Login, sucede que adapte un form de Ext.js, y para validar los usuarios uso un archivo php, sin embargo, del from se envian los valores (User y Pwd sin problemas, probado con el Chrome Developer Tools), pero en el archivo PHP, no me esta validando la informacion, quisiera saber si es que hay algun problema. les comparto el codigo:
Código Javascript:
Ver original
  1. /*!
  2. * Ext JS Library 3.1.0
  3. * Adaptado por Ag@l
  4. */
  5. Ext.onReady(function(){
  6.  
  7. Ext.QuickTips.init();
  8.  
  9. var bd = Ext.getBody();
  10.  
  11. var simple = new Ext.FormPanel({
  12.     frame: true,
  13.     width:300,
  14.     autoHeight:true,
  15.     bodyStyle: 'padding:10px;background-color:#fff',
  16.     waitMsgTarget: true,
  17.     monitorValid:true,
  18.     items:[{
  19.         labelAlign: 'left',
  20.         labelWidth: 100,
  21.             items: [
  22.                 new Ext.form.FieldSet({
  23.                 title: 'Ingrese Datos',
  24.                 autoHeight: true,
  25.                 defaultType: 'textfield',
  26.                     items: [{
  27.                         fieldLabel: 'User',
  28.                         name: 'user',
  29.                         width:90,
  30.                         allowBlank:false
  31.                     },{
  32.                         fieldLabel: 'Password',
  33.                         name: 'passwd',
  34.                         inputType:'password',
  35.                         width:90,
  36.                         allowBlank:false
  37.                     }]
  38.                 })
  39.                 ]
  40.         }],
  41.     buttons: [{
  42.         text: 'Ingresar',
  43.         formBind: true,
  44.         handler: function() {
  45.                 simple.getForm().submit({
  46.                 method:'POST',
  47.                 url:'login.php',
  48.                 waitTitle:'Conectando',
  49.                 waitMsg:'Validando...',
  50.                 success:function(form, action){
  51.                     obj = Ext.util.JSON.decode(action.response.responseText);
  52.                     //waitMsg:'Validando...',
  53.                     Ext.Msg.alert('Acceso', 'Acceso Permitido!', function(btn, text){
  54.                         if (btn == 'ok'){
  55.                             var redirect = '../Body/Index/index.php';
  56.                             window.location = redirect;
  57.                         }
  58.                     });
  59.                 },
  60.                 failure:function(form, action){
  61.                     //if(action.failureType == 'server'){
  62.                         obj = Ext.util.JSON.decode(action.response.responseText);
  63.                         Ext.Msg.alert('Error!','Acceso Restringido', function(btn, text){
  64.                             if (btn == 'ok'){
  65.                                 window.location.href="index.php";
  66.                                 }
  67.                                 })
  68.                     //}
  69.                 }
  70.             });
  71.             }
  72.     }],
  73.     keys: [{
  74.             key: [Ext.EventObject.ENTER],
  75.             handler: function() {
  76.                 simple.getForm().submit({
  77.                 method:'POST',
  78.                 url:'login.php',
  79.                 waitTitle:'Conectando',
  80.                 waitMsg:'Validando...',
  81.                 success:function(form, action){
  82.                     obj = Ext.util.JSON.decode(action.response.responseText);
  83.                     //waitMsg:'Validando...',
  84.                     Ext.Msg.alert('Acceso', 'Acceso Permitido!', function(btn, text){
  85.                         if (btn == 'ok'){
  86.                             var redirect = '../Body/Index/index.php';
  87.                             window.location = redirect;
  88.                         }
  89.                     });
  90.                 },
  91.                 failure:function(form, action){
  92.                     //if(action.failureType == 'server'){
  93.                         obj = Ext.util.JSON.decode(action.response.responseText);
  94.                         Ext.Msg.alert('Acceso!','Acceso Restringido', function(btn, text){
  95.                             if (btn == 'ok'){
  96.                                 window.location.href="index.php";
  97.                                 }
  98.                                 })
  99.                     //}
  100.                 }
  101.             });
  102.             }
  103.         }
  104.         ]
  105.     });
  106.  
  107. var winLogin = new Ext.Window({
  108.         title: '::Ingreso al Sistema::',
  109.         layout: 'fit',
  110.         width: 340,
  111.         height: 190,
  112.         resizable: true,
  113.         closable: true,
  114.         items: [simple]
  115.     });
  116.  
  117.     winLogin.show();
  118.  
  119. });
LOGIN.php
Código PHP:
Ver original
  1. <?php
  2. header('Content-Type: text/html; charset=iso-8859-1');
  3. include "../../Conexion/cnx_php.php";
  4.  
  5. $usuario = $_POST['user'];
  6. $clave = $_POST['passwd'];
  7.  
  8. $sql = "SELECT * FROM T_LOGIN WHERE [USER] = '$usuario' AND PASSWD = '$clave'";
  9. //echo $sql;
  10. $res = mssql_query($sql)
  11.     if ( mssql_num_rows($res) == 1 ){
  12.         $result["success"] = true;
  13.     }else{
  14.         $result["success"] = false;
  15.     }
  16. echo json_encode($result);
  17. ?>

agradecere mucho su apoyo....!!!!
__________________
Lo que no se....tampoco creo saberlo....