Ввод пароля не работает с AS3, MySQL и PHP?

Я использую PHP, AS3 и MySQL. У меня проблема, когда я пытаюсь войти в систему входа в систему AS3, интегрированную с PHP и MySQL, она говорит: «Данные входа не соответствуют нашим записям».

Я обошел MySQL и изменил пароль вручную, и тогда это сработало!
Но дело в том, что всякий раз, когда кто-то регистрирует учетную запись, данные отправляются в мою базу данных MySQL. Но всякий раз, когда кто-то пытается войти с этими данными, это не сработает. Но если мы изменим пароль вручную внутри MySQL, это как-то сработает. Это какая-то текстовая ошибка во Flash или что-то странное, что отправляется в MySQL из flash?

Вот код PHP:

<?php

include_once("connect.php");

$username = $_POST['username'];
$pass = $_POST['pass'];
$userbio = $_POST['userbio'];
$email = $_POST['email'];

$usercheck = mysql_query("SELECT * FROM users WHERE email = '$email'");

if(mysql_num_rows($usercheck) > 0){
exit("result_message=Email is in use");
} else {
$sql = "INSERT INTO users (username, pass, user_bio, email) VALUES ('$username', '$pass', '$userbio', '$email')";

mysql_query($sql) or exit("result_message=Error");

exit("result_message=Success");
}

?>

Вот регистрационный код AS3:

import flash.display.*;
import flash.events.*;
import flash.net.*;

register_button.addEventListener(MouseEvent.MOUSE_DOWN, checkForm);MovieClip(root).RegBG.username_text.text = "";
password_text.text = "";
email_text.text = "";/*
validate the user's input
*/

function checkForm (e:MouseEvent):void {

if (MovieClip(root).RegBG.username_text.text != "" && password_text.text != "" && email_text.text != "") {

sendForm();

} else {

result_text.text = "Please fill in all the fields!";

}

}

/*
function we use to send the form
*/

function sendForm ():void {

/*
we use the URLVariables class to store our php variables
*/

var phpVars:URLVariables = new URLVariables();

phpVars.username = MovieClip(root).RegBG.username_text.text;
phpVars.pass = password_text.text;
phpVars.email = email_text.text;

/*
we use the URLRequest method to get the address of our php file and attach the php vars.
*/

var urlRequest:URLRequest = new URLRequest("http://lumosityentertainment.hostei.com/phpcodes/register.php");

/*
the POST method is used here so we can use php's $_POST function in order to recieve our php variables.
*/

urlRequest.method = URLRequestMethod.POST;

/*
this attaches our php variables to the url request
*/

urlRequest.data = phpVars;

/*
we use the URLLoader class to send the request URLVariables to the php file
*/

var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

/*
runs the function once the php file has spoken to flash
*/

urlLoader.addEventListener(Event.COMPLETE, showResultreg);

/*
we send the request to the php file
*/

urlLoader.load(urlRequest);

}

/*
function to show result
*/

function showResultreg (e:Event):void {

result_text.text = "" + e.target.data.result_message;

}

Вот код авторизации AS3:

import flash.events.MouseEvent;

function processLogin():void {

/*
variables that we send to the php file
*/var phpVars:URLVariables = new URLVariables();

/*
we create a URLRequest  variable. This gets the php file path.
*/

var phpFileRequest:URLRequest = new URLRequest("http://lumosityentertainment.hostei.com/phpcodes/controlpanel.php");

/*
this allows us to use the post function in php
*/

phpFileRequest.method = URLRequestMethod.POST;

/*
attach the php variables to the URLRequest
*/

phpFileRequest.data = phpVars;

/*
create a new loader to load and send our urlrequest
*/

var phpLoader:URLLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);

/*
now lets create the variables to send to the php file
*/

phpVars.systemCall = "checkLogin";
phpVars.username = username.text;
phpVars.pass = password_show.text;

/*
this will start the communication between flash and php
*/
phpLoader.load(phpFileRequest);
phpLoader.addEventListener(Event.COMPLETE, showResult);

}

PlayButton.addEventListener(MouseEvent.MOUSE_DOWN, checkLogin);

function checkLogin(E:MouseEvent): void {

if (username.text == "" || password_show.text == "") {

if (username.text == "") {

username.text = "Enter your username";
}
if (password_show.text == "") {

password_show.text = "Enter your password";
}
} else {
processLogin();
}
}

function showResult (event:Event):void {

charactername = username.text

result_text.text = "" + event.target.data.logincheck;if(result_text.text == "The login details does not match our records."){
trace("Login Failed");
} else {
result_text.text = "Success. Please wait till game is released to play!";
//LOADING FROM PHP
}

}

Также, когда я вхожу во фрейм учетной записи я получаю эту ошибку:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FantasyDreamsAS3_fla::MainTimeline/frame2()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at FantasyDreamsAS3_fla::BGCharacterCreate_22()
at flash.display::MovieClip/gotoAndStop()
at FantasyDreamsAS3_fla::MainTimeline/gotomakechar()

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector