ExcellenceGS
04-20-2011, 11:08 PM
Heya Members of Actionscript,
I have been behind my computer for all day long now.
Finally got the login system to actually login but, a major BUT!
I cannot fill anything in Flash input textboxes or else it screws up.
let me give you some examples.
<?php
//My login Script
// declare variables
$user = $_POST['user'];
$pass = $_POST['pass'];
//
// mysql connection variables
$host = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'heathens';
$table = 'egsmembers';
//
// connect to db
$db = @mysql_connect($host,$dbuser,$dbpass) or die("error=could not connect to $host");
$db = mysql_select_db($dbname);
if(!$db)
{
echo "&status=could not connect to $dbname table";
exit;
}
//
// check table
$query = mysql_query("SELECT * FROM $table WHERE USERname = '$user' AND USERpass = '$pass'");
$num = mysql_num_rows($query);
if($num>0)
{
echo "&lerror=ok";
print "&checklog=1";
} else {
echo "&lerror=not ok";
echo "&cool=$host";
echo "&checklog=0";
}
?>
the above works correctly.
now the Flash Part.
// init LoadVars Object
lv = new LoadVars();
// set Variables
lv.user = "egsadmin";
lv.pass = "adminegs";
lv.checklog ="0";
lv.error = "none";
// define onLoad Callback
lv.onLoad = onLoadCallBack;
// send and load variables
// onLoad Callback
function onLoadCallBack(succes)
{
// if succes
if(succes)
{
// trace variables
_root.status.text="Retreiving info"
trace(this.user);
trace(this.pass);
trace(this.checklog);
trace(this.lerror);
trace(this.cool);
_root.status.text="Checking info"
if(this.checklog == 1){
_root.status.text="Succes!"
_root.gotoAndStop(3);
}
if(this.checklog == 0){
_root.status.text="Login Failed, please make sure you have entered the correct Username and Password."
_root.gotoAndStop(2);
}
}
else
{
// loading failed
trace("Loading Error!!");
}
}
stop();
flash button:
on(release){
status.text = "Begin Login Process - Wait...";
lv.sendAndLoad("/localhost/login.php", lv, "POST");
}
it only works when the variables are like this:
// set Variables
lv.user = "egsadmin";
lv.pass = "adminegs";
if I type something in the inputbox in flash I receive this.
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="MS Reference Sans Serif" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">test</FONT></P></TEXTFORMAT>
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="_sans" SIZE="13" COLOR="#000000" LETTERSPACING="0" KERNING="0">test</FONT></P></TEXTFORMAT>
0
not ok
localhost
With the script setup like:
// set Variables
lv.user = "test";
lv.pass = "test";
it showstest
test
1
ok
It just doesn't work when I type text into my "Inputtextboxes".
properties of my "inputtextbox":
username: lv.user
pass:lv.pass
I have no idea how I really can explain this is easy as I just started PHP and MySQL today.
the problem is in Flash I believe, when I type something in the "username" textfield it comes up with a huge script like this, no wonder it cannot compare the variable to the ones inside the database if it's like this...
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="MS Reference Sans Serif" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">test</FONT></P></TEXTFORMAT>
I receive all of this within flash with these commandes can also be found in the top Action Script trace(this.user); trace(this.pass);
it's really getting frustrating and I am all out of luck. So maybe you guys could help me out a little?
thanks in advance!
-------
I'm sorry if there are any grammatical/spelling errors.
It's late and I'm sleepy and a bit frustrated!
I have been behind my computer for all day long now.
Finally got the login system to actually login but, a major BUT!
I cannot fill anything in Flash input textboxes or else it screws up.
let me give you some examples.
<?php
//My login Script
// declare variables
$user = $_POST['user'];
$pass = $_POST['pass'];
//
// mysql connection variables
$host = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'heathens';
$table = 'egsmembers';
//
// connect to db
$db = @mysql_connect($host,$dbuser,$dbpass) or die("error=could not connect to $host");
$db = mysql_select_db($dbname);
if(!$db)
{
echo "&status=could not connect to $dbname table";
exit;
}
//
// check table
$query = mysql_query("SELECT * FROM $table WHERE USERname = '$user' AND USERpass = '$pass'");
$num = mysql_num_rows($query);
if($num>0)
{
echo "&lerror=ok";
print "&checklog=1";
} else {
echo "&lerror=not ok";
echo "&cool=$host";
echo "&checklog=0";
}
?>
the above works correctly.
now the Flash Part.
// init LoadVars Object
lv = new LoadVars();
// set Variables
lv.user = "egsadmin";
lv.pass = "adminegs";
lv.checklog ="0";
lv.error = "none";
// define onLoad Callback
lv.onLoad = onLoadCallBack;
// send and load variables
// onLoad Callback
function onLoadCallBack(succes)
{
// if succes
if(succes)
{
// trace variables
_root.status.text="Retreiving info"
trace(this.user);
trace(this.pass);
trace(this.checklog);
trace(this.lerror);
trace(this.cool);
_root.status.text="Checking info"
if(this.checklog == 1){
_root.status.text="Succes!"
_root.gotoAndStop(3);
}
if(this.checklog == 0){
_root.status.text="Login Failed, please make sure you have entered the correct Username and Password."
_root.gotoAndStop(2);
}
}
else
{
// loading failed
trace("Loading Error!!");
}
}
stop();
flash button:
on(release){
status.text = "Begin Login Process - Wait...";
lv.sendAndLoad("/localhost/login.php", lv, "POST");
}
it only works when the variables are like this:
// set Variables
lv.user = "egsadmin";
lv.pass = "adminegs";
if I type something in the inputbox in flash I receive this.
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="MS Reference Sans Serif" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">test</FONT></P></TEXTFORMAT>
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="_sans" SIZE="13" COLOR="#000000" LETTERSPACING="0" KERNING="0">test</FONT></P></TEXTFORMAT>
0
not ok
localhost
With the script setup like:
// set Variables
lv.user = "test";
lv.pass = "test";
it showstest
test
1
ok
It just doesn't work when I type text into my "Inputtextboxes".
properties of my "inputtextbox":
username: lv.user
pass:lv.pass
I have no idea how I really can explain this is easy as I just started PHP and MySQL today.
the problem is in Flash I believe, when I type something in the "username" textfield it comes up with a huge script like this, no wonder it cannot compare the variable to the ones inside the database if it's like this...
<TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="MS Reference Sans Serif" SIZE="15" COLOR="#000000" LETTERSPACING="0" KERNING="0">test</FONT></P></TEXTFORMAT>
I receive all of this within flash with these commandes can also be found in the top Action Script trace(this.user); trace(this.pass);
it's really getting frustrating and I am all out of luck. So maybe you guys could help me out a little?
thanks in advance!
-------
I'm sorry if there are any grammatical/spelling errors.
It's late and I'm sleepy and a bit frustrated!