id autoincrementable
user
pass
verificador
en el verificador es donde quiero que autentifique al link que deseo ir
por ejemplo
si el user es correcto y el pass y en la base tengo que este usuario es (verificador en base mysql) "master" que me redireccione a google es un ejemplo
o bien si el verificador es "agente" me lleve a yahoo, cuando hace la validacion a el verificador se queda pensando y no hace nada espero y me puedan ayudar???
PHP
<?php
require_once('connect.php');
$user = utf8_decode (@$_POST['usuario']);
$pass = utf8_decode (@$_POST['password']);
$sql = "SELECT * FROM users WHERE user = '$user' AND pass = '$pass'";
$query = mysql_query($sql);
$very = mysql_fetch_row($query);
$tot = mysql_num_rows($query);
$validate = "";
if($tot > 0){
$validate = "1";
}else{
$validate = "0";
}
echo "&validate=" . $validate . "&verificador=" .$very[3];
?>
AS3
var variables:URLVariables;
var urlPhp:URLRequest;
var retorno:URLLoader;
Ingresar_btn.addEventListener(MouseEvent.CLICK, sendDados);
password_txt.displayAsPassword=true;
function sendDados(e:MouseEvent):void {
if (usuario_txt.text==""||password_txt.text=="") {
status_txt.text="Campos vacios verifique...";
} else {
variables = new URLVariables();
variables.usuario=usuario_txt.text;
variables.password=password_txt.text;
urlPhp=new URLRequest("php/controlpanel.php");
urlPhp.method=URLRequestMethod.POST;
urlPhp.data=variables;
retorno = new URLLoader();
retorno.dataFormat=URLLoaderDataFormat.VARIABLES;
retorno.addEventListener(Event.COMPLETE, retornoCompleto);
retorno.load(urlPhp);
status_txt.text="Conectando al Servidor...";
}
}
function retornoCompleto(e:Event):void {
var validate:String=e.target.data.validate;
var verificador:String=e.target.data.verificador;
if (validate=="0") {
status_txt.text="Login Incorrecto...";
} else {
status_txt.text="Login Correcto!!!";
switch (verificador) {
case "Master" :
loadURL("http://site1");
break;
case "Agente" :
loadURL("http://site1");
break;
}
}
}
function loadURL(url):void {
var request:URLRequest=new URLRequest(url);
try {
navigateToURL(request, '_blank');
} catch (e:Error) {
trace("Erro encontrado!");
}
}