A ver, tengo un simple formulario de autenticacion el cual he conseguido que funcione en la red, pero que en local me da error. El error me da cuando PHP le pasa una variable a Flash, éste no la reconoce y me da undefined. Puede ser por la seguridad q han puesto en el nuevo player o por el PHP?
Os pongo el codigo para q lo veais a ver q pasa:
Archivo .fla:
Código :
System.security.loadPolicyFile ("policyFile.xml"); boton.setStyle("themeColor", "haloOrange"); //Fuentes boton.fontFamily = "Trebuchet MS"; boton.fontSize = 12; boton.label = "Aceptar"; boton.clickHandler = function() { valida(); }; var formListener:Object = new Object(); formListener.enter = function(evt) { valida(); }; nombre.addEventListener("enter", formListener); password.addEventListener("enter", formListener); Selection.setFocus(nombre); function valida() { if (nombre.text.length == 0) { aviso.text = "Por favor, introduzca nombre de usuario"; Selection.setFocus(nombre); return false; } if (password.text.length == 0) { aviso.text = "Por favor, introduzca contraseña"; Selection.setFocus(password); return false; } aviso.text = ''; login_var = new LoadVars(); result_var = new LoadVars(); login_var.login = nombre.text; login_var.pass = password.text; login_var.sendAndLoad("comprueba.php", result_var, "POST"); result_var.onLoad = function(ok:Boolean) { if (ok) { aviso.text = this.hay; // aviso.text = this.hay; if (this.hay == 1) { // aviso.text = "OK!!!!!"; } else { // aviso.text = "usuario o contraseña inválida"; Selection.setFocus(nombre); Selection.setSelection(0, nombre.text.length); } } else { aviso.text = "No hay conexion con el servidor"; nombre.enabled = false; password.enabled = false; boton.enabled = false; } }; return true; }
Archivo .xml
Código :
<cross-domain-policy> <allow-access-from domain="*" /> </cross-domain-policy>
Archivo .php
Código :
<? include "./db/conexion.php"; $usr_sql="select Login,Password from usuario"; $result=mysql_query($usr_sql); if ($existe=mysql_fetch_array($result)){ if (($_POST["login"]==$existe[Login]) && ($_POST["pass"]==$existe[Password])){ echo "hay=1"; }else{ echo "hay=0"; } } ?>
Gracias
