Ver Mensaje Individual
  #5 (permalink)  
Antiguo 25/05/2009, 01:25
erevaristo
 
Fecha de Ingreso: abril-2009
Ubicación: En dust 2
Mensajes: 149
Antigüedad: 15 años, 9 meses
Puntos: 2
Respuesta: error al crear session

estoy utilizando la libreria extjs, desde ahi mando los datos al php, este es el codigo del js:

Código:
Ext.onReady(function(){
    Ext.QuickTips.init();

    function validar(email, pass, sb, log)
    {
	    var conn = new Ext.data.Connection;
	    sb.showBusy('Comprobando Datos...');
	    
	    setTimeout(function(){
		    conn.request({url: 'login.php', params: {email: email, pass: pass},
		    callback: function(options, success, response)
		    {
			    if (success)
			    {
				    var xmlRespuesta = response.responseXML;
				    
				    var nodosElementos = xmlRespuesta.getElementsByTagName('resultado');
				    atributo = nodosElementos[0].getAttribute('success');
				    
				    if (atributo == 'Error')
				    {
					    log.getForm().reset();
					    sb.showBusy('Insertar Datos');
					    sb.setStatus({
						    iconCls:'',
						    clear: true
					    });
					    log.getEl().unmask();
					    Ext.MessageBox.show({
						    title:'Error',
						    msg:'Usuario o Password Incorrectos',
						    buttons: Ext.MessageBox.OK,
						    icon: 'imagen_error'
					    })
				    }
				    else
				    {
					    var url = 'mod/inUsuario.html';
					    
					    Ext.MessageBox.show({
						    msg: 'Accediendo al Sistema',
						    progressText: 'Accediendo al sistema',
						    width:300,
						    wait:true,
						    waitConfig: {interval:100},
						    animEl: 'botonIniciar'
					    }); 	
					    setTimeout(function(){
						    location = url; 
					    }, 3500);
				    }
			    }
		    }
		    });
	    }, 4000);
    }
    
        
        
    var email = new Ext.form.TextField({
	    id: 'idemail',
	    fieldLabel: 'Email',
	    name: 'email',
	    vtype: 'email',
	    blankText: "El campo email es requerido"
    });
    
    var password = new Ext.form.TextField({
	    id: 'idpassword',
	    inputType: 'password',
	    fieldLabel: 'Password',
	    name: 'pass',
	    blankText: "El campo password es requerido"
    });
    
    var log = new Ext.FormPanel({
	    id: 'login',
	    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'
	    },
	    defaultType: 'textfield',
	    items: [email, password],
	    buttons:
	    [{
		    text: 'Entrar',
		    handler: function(){
			if(log.getForm().isValid()){
				    var sb = Ext.getCmp('form-statusbar');
				    sb.showBusy('Comprobando Datos...');
				    log.getEl().mask();
				    		    
				    var emailValue = email.getValue();
				    var passValue = password.getValue();
				    validar(emailValue, passValue, sb, log);
			}
                    }
	    },{
		    text:'Limpiar',
		    handler: function(){
			    log.getForm().reset();
		    }
	    }]
    });
    
    log.render('lg');
    
    new Ext.Panel({
        title: 'Iniciar Sesión',
        renderTo: Ext.getBody(),
        width: 350,
        autoHeight: true,
        layout: 'fit',
        items: log,
        bbar: new Ext.StatusBar({
            id: 'form-statusbar',
            defaultText: 'Insertar Datos',
            plugins: new Ext.ux.ValidationStatus({form:'login'})
        })
    });
});