-
AS,PhP,MySQL Login System
hi i am getting the undefiend resoult on php feedback
php code:
<?php
include_once "connect.php";
$username = $_POST['username'];
$password = $_POST['password'];
if ($_POST['systemCall'] == "checkLogin") {
$sql = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$query = mysql_query($sql);
$login_counter = mysql_num_rows($query);
if ($login_counter > 0) {
while ($data = mysql_fetch_array($query)) {
$userbio = $data["user_bio"];
print "systemResult=$userbio";
}
} else {
print "systemResult=The login details dont match our records.";
}
}
?>
as3 code:
public function processLogin():void
{
var phpVars:URLVariables = new URLVariables();
var phpFileRequest:URLRequest = new URLRequest("http://gorgodongames.webatu.com/php/controlpanel.php");
phpFileRequest.method = URLRequestMethod.POST;
phpFileRequest.data = phpVars;
var phpLoader:URLLoader = new URLLoader();
navigateToURL (phpFileRequest)
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.addEventListener(Event.COMPLETE, showResult);
phpVars.systemCall = "checkLogin";
phpVars.username = username.text;
phpVars.password = password.text;
phpLoader.load(phpFileRequest);
}
public function showResult(e:Event):void
{
RTXT.autoSize = TextFieldAutoSize.LEFT;
RTXT.text = "" + e.targrt.data.systemResult;
}
the database is setup and the table is there, the connect php works fine cos i created the tables using it.
please help i am going insane here. if you cant find any error that means i set the path in my as3 code wrong but when i navigate to it it opens my php file so i dont know what to do. Help lease
Last edited by Gorgodon; 07-30-2014 at 08:04 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|