Eu estou com um problema no código de um sistema que eu e uns amigos estão desenvolvendo.
O erro e quando o Flash tenta exibir dados vindo do DB através do PHP, eu não sei se o erro esta no AS 2 ou no PHP.
Preciso muito resolver este problema, pois é um trabalho de conclusão de curso, e realmente não faço idéia de onde pode ser, ou o que pode ser o erro.
Vou disponibilizar o código AS 2 e PHP que utilizo no sistema.
Uma previa do sistema ara testar se quiserem, para entender melhor como funciona (Login: b@bb.com senha: bb)
http://www.mestresdasartes.com.br/tecnofeira/
Página PHP "login.php"
CÓDIGO
<?php
include_once("config.php");
/*Variáveis vindas do Flash*/
$email_cliente = $_POST["email_cliente"];
$cod_seguranca = $_POST["cod_seguranca"];
$nome_cliente = $_POST["nome_cliente"];
$cpf_cliente = $_POST["cpf_cliente"];
$num_rg = $_POST["num_rg"];
$tel_cliente = $_POST["tel_cliente"];
$senha_cliente = $_POST["senha_cliente"];
/*Selecionando a Ação*/
$action = $_GET["action"];
/*Seleciona a ação*/
switch ("$action") {
/* -------------------------- */
/* Caso a ação seja Pesquisar */
/* -------------------------- */
case 'pesquisar':
if ($cod_seguranca == 1)
{
/*Pesquisará registro de um cliente*/
$sqlPesquisa = mysql_query("Select * from cliente where login_email_cliente='$email_cliente'") or die ("Ops, deu Erro!!!");
$linha = mysql_fetch_array($sqlPesquisa);
if ($linha == 1){
$exibeCod = "1". $linha[1];
$exibeEmail = "2". $linha[2];
$exibeNome = "3". $linha[4];
$exibeSenha = "4". $linha[5];
$exibeCPF = "5". $linha[6];
$exibeRG = "6". $linha[7];
$exibeTel = "7". $linha[8];
print "&exibeCod = $exibeCod&exibeEmail = $exibeEmail&exibeNome = $exibeNome&exibeSenha = $exibeSenha&exibeCPF = $exibeCPF&exibeRG = $exibeRG&exibeTel = $exibeTel&mensagem= ";
}else{
print "&mensagem=Usuário não encontrado";
}
}else if ($cod_seguranca >= 2 || >=4)
{
/*Pesquisará registro de um funcionário*/
$sqlPesquisa = mysql_query("Select * from funcionario where email_func='$email_func'") or die ("Ops, deu Erro!!!");
$linha = mysql_fetch_array($sqlPesquisa);
if ($linha == 1){
$exibeCod = "". $linha[cod_func];
$exibeEmail = "". $linha[email_func];
$exibeNome = "". $linha[nome_func];
$exibeSenha = "". $linha[senha_func];
$exibeCPF = "". $linha[cpf_func];
$exibeRG = "". $linha[num_rg_func];
$exibeTel = "". $linha[tel_func];
print "&exibeCod = $exibeCod&exibeEmail = $exibeEmail&exibeNome = $exibeNome&exibeSenha = $exibeSenha&exibeCPF = $exibeCPF&exibeRG = $exibeRG&exibeTel = $exibeTel";
}else{
print "&mensagem=Usuário não encontrado";
}
}
break;
}
?>
include_once("config.php");
/*Variáveis vindas do Flash*/
$email_cliente = $_POST["email_cliente"];
$cod_seguranca = $_POST["cod_seguranca"];
$nome_cliente = $_POST["nome_cliente"];
$cpf_cliente = $_POST["cpf_cliente"];
$num_rg = $_POST["num_rg"];
$tel_cliente = $_POST["tel_cliente"];
$senha_cliente = $_POST["senha_cliente"];
/*Selecionando a Ação*/
$action = $_GET["action"];
/*Seleciona a ação*/
switch ("$action") {
/* -------------------------- */
/* Caso a ação seja Pesquisar */
/* -------------------------- */
case 'pesquisar':
if ($cod_seguranca == 1)
{
/*Pesquisará registro de um cliente*/
$sqlPesquisa = mysql_query("Select * from cliente where login_email_cliente='$email_cliente'") or die ("Ops, deu Erro!!!");
$linha = mysql_fetch_array($sqlPesquisa);
if ($linha == 1){
$exibeCod = "1". $linha[1];
$exibeEmail = "2". $linha[2];
$exibeNome = "3". $linha[4];
$exibeSenha = "4". $linha[5];
$exibeCPF = "5". $linha[6];
$exibeRG = "6". $linha[7];
$exibeTel = "7". $linha[8];
print "&exibeCod = $exibeCod&exibeEmail = $exibeEmail&exibeNome = $exibeNome&exibeSenha = $exibeSenha&exibeCPF = $exibeCPF&exibeRG = $exibeRG&exibeTel = $exibeTel&mensagem= ";
}else{
print "&mensagem=Usuário não encontrado";
}
}else if ($cod_seguranca >= 2 || >=4)
{
/*Pesquisará registro de um funcionário*/
$sqlPesquisa = mysql_query("Select * from funcionario where email_func='$email_func'") or die ("Ops, deu Erro!!!");
$linha = mysql_fetch_array($sqlPesquisa);
if ($linha == 1){
$exibeCod = "". $linha[cod_func];
$exibeEmail = "". $linha[email_func];
$exibeNome = "". $linha[nome_func];
$exibeSenha = "". $linha[senha_func];
$exibeCPF = "". $linha[cpf_func];
$exibeRG = "". $linha[num_rg_func];
$exibeTel = "". $linha[tel_func];
print "&exibeCod = $exibeCod&exibeEmail = $exibeEmail&exibeNome = $exibeNome&exibeSenha = $exibeSenha&exibeCPF = $exibeCPF&exibeRG = $exibeRG&exibeTel = $exibeTel";
}else{
print "&mensagem=Usuário não encontrado";
}
}
break;
}
?>
Flash AS 2
CÓDIGO
// Recebendo dados da pesquisa do PHP
var objEnvia:LoadVars = new LoadVars();
var objRecebe:LoadVars = new LoadVars();
// Botao Pesquisar (Pesquisa)
_root.bt_pesquisa.onEnterFrame = function() {
if (mouse_over_bt_pesqOver) {
_root.bt_pesquisa.nextFrame();
} else {
_root.bt_pesquisa.prevFrame();
}
};
_root.bt_pesqOver.onRollOver = function() {
_root.mouse_over_bt_pesqOver = true;
};
_root.bt_pesqOver.onRollOut = function() {
_root.mouse_over_bt_pesqOver = auxiliar5;
};
_root.bt_pesqOver.onPress = function() {
pesquisa();
};
function pesquisa(){
objEnvia.cod_seguranca = 1;
objEnvia.sendAndLoad("http://www.mestresdasartes.com.br/tecnofeira/login.php?action=pesquisar",objRecebe,"POST");
mensagem.text = "Procurando...";
/*Quando os resultados forem recebidos do servidor*/
objRecebe.onLoad = function(ok) {
cod.text = this.exibeCod;
email.text = this.exibeEmail;
senha.text = this.exibeSenha;
nome.text = this.exibeNome;
cpf.text = this.exibeCPF;
rg.text = this.exibeRG;
tel.text = this.exibeTel;
mensagem.text = this.mensagem;
}
}
var objEnvia:LoadVars = new LoadVars();
var objRecebe:LoadVars = new LoadVars();
// Botao Pesquisar (Pesquisa)
_root.bt_pesquisa.onEnterFrame = function() {
if (mouse_over_bt_pesqOver) {
_root.bt_pesquisa.nextFrame();
} else {
_root.bt_pesquisa.prevFrame();
}
};
_root.bt_pesqOver.onRollOver = function() {
_root.mouse_over_bt_pesqOver = true;
};
_root.bt_pesqOver.onRollOut = function() {
_root.mouse_over_bt_pesqOver = auxiliar5;
};
_root.bt_pesqOver.onPress = function() {
pesquisa();
};
function pesquisa(){
objEnvia.cod_seguranca = 1;
objEnvia.sendAndLoad("http://www.mestresdasartes.com.br/tecnofeira/login.php?action=pesquisar",objRecebe,"POST");
mensagem.text = "Procurando...";
/*Quando os resultados forem recebidos do servidor*/
objRecebe.onLoad = function(ok) {
cod.text = this.exibeCod;
email.text = this.exibeEmail;
senha.text = this.exibeSenha;
nome.text = this.exibeNome;
cpf.text = this.exibeCPF;
rg.text = this.exibeRG;
tel.text = this.exibeTel;
mensagem.text = this.mensagem;
}
}

Help














