Groups | Blog | Home
all groups > flash actionscript > january 2004 >

flash actionscript : Flash to php


Walking_fishy
1/21/2004 6:23:03 PM
I have made a flash logon, so that when the button is pressed the user name and password fields are sent to a php file which will validate them......but i dont know what the action code for the buton is

name for user field is userName
name for pass fiels is passwordField
the php code works if i use a html table logon and submit button but i cant get it to work in flash

can some please help???

Jack.
1/21/2004 7:35:10 PM
if you copy/ paste the html logon code that works <form.../form> here,
you might get a faster answer :)

regards
Walking_fishy
1/21/2004 9:11:09 PM
ok this is the html code.....i made the user name and password fields in flash, along with the button i want to press when i want the form submitted

<html>
<head><title>Login form</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="#333333" text="#CCCCCC">
<center>
<form action="login.php" method="post">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="420" height="200">
<param name="movie" value="buttons/login.swf">
<param name=quality value=high>
<embed src="buttons/login.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="420" height="200"></embed>
</object>
</form>
</center>
</body>
</html>

but it is the flash code i am stuck with......i cant get it to tell the following php code what the user put in....

<?
mysql_connect("localhost", "user", "password")
or die ("Unable to connect to server.");
mysql_select_db("secretDB")
or die ("Unable to select database.");
$sql = "SELECT id
FROM users
WHERE username='$username' and password='$password'";
$result = mysql_query($sql)
or die ("Unable to get results.");
$num = mysql_num_rows($result)
or die ("You're not authorized to be here. If you feel you have recieved this
message in error, please contact the <a
href=\"mailto:walking_fishy@hotmail.com\">webmaster</a>");
if ($num == 1) {
echo "Welcome <font size=5><strong>$username</strong></font><br>";
echo "You are now logged in<br>";
}
?>

if needs be, i have hosted the flash at www.bridge1.co.uk

Jack.
1/22/2004 4:52:05 PM
<form..<object...../object></form> this is not possible.

try something like -

Submit_btn.onPress = function(){ // instance name of button
lv = new LoadVars();
sv = new LoadVars();
sv.username = userName.text;
sv.password = passwordField.text; // instance names of textfields
lv.onLoad = function(){
trace(unescape(lv); // outputs any variables returned from the php
};
sv.sendAndLoad("login.php",lv,"POST");
};


regards
AddThis Social Bookmark Button