PDA

View Full Version : FLASH/PHP Integration


junior0128
08-30-2005, 05:54 PM
I was wondering if someone could help me out. Im using a script that verifies a username/password in flash and if the passwords match, it autoforwards the user to a new page (home.php) and keeps them logged in.

login = new LoadVars();
login.pass = pass;
login.user = user;
login.sendAndLoad("phpfile.php,login,"POST");
login.onLoad=function(success){
if (success) {
getURL ("your html page");
}
else { error.txt = " error message "
}
};

so far, im using this above but cant manage to get it to work. Can anyone put together a quick flash file for me if the file to go to is HOME.PHP?

magnav0x
08-30-2005, 06:18 PM
Everything looks fine to me except for a quotation left off of the php file in the sendAndLoad function. This should work ok:

login = new LoadVars();
login.pass = pass;
login.user = user;
login.sendAndLoad("phpfile.php","login","POST");
login.onLoad=function(success){
if (success) {
getURL ("HOME.PHP");
}
else {
error.txt = " error message ";
}
};

junior0128
08-30-2005, 08:30 PM
I made 2 input fields called pass and user, plus a made btn that is going to be my submit button, its an image of a blue box with the word GO in it. My php scripts are located in a directory called library and there are files called connect.php and login.php, ive tried using both. still no luck.

ive been told it isnt that difficult but for some reason i just cant get it to work. can anyone please provide a sample .fla file?

junior0128
08-30-2005, 09:12 PM
on (release)
{
if(userName.length > 0 && userPassword.length > 0)
{
myVars = new LoadVars();
myVars.username = userName
myVars.password = userPassword
myVars.action = 'frmLogin';
myVars.sendAndLoad(library/login.php, myVars, 'POST');
myVars.onLoad = function()
{
if(!this.error && this.user > 0)
{
getUrl('home.php');
} else {
getUrl('signup.html');
}
userName.selectable = true;
userPassword.selectable = true;
loginButton.enabled = true;
}
userName.selectable = false;
userPassword.selectable = false;
loginButton.enabled = false;
}
}
I had more success with the above script. when i typed in a username/password, and click submit, it atleast sent me to the page signup.html, but it isnt checking the php file to see if the password/username is right.