Groups | Blog | Home
all groups > flash data integration > december 2004 >

flash data integration : newbie help: Postnuke User login block from PHP to Flash?


awillys
12/30/2004 9:48:49 AM
Hello,

for my upcoming website based on Postnuke i would like to use flash as the
user login block.

Basically i would need to print this codein Flash:

<?php
if(!pnUserLoggedIn()){
?>
<form action="user.php" method="post">Username<input type="text" name="uname"
size="12" maxlength="20">
Password<input type="password" name="pass" size="12" maxlength="20"><input
type="checkbox" value="1" name="rememberme" />
<input type="hidden" name="module" value="NS-User" /><input type="hidden"
name="op" value="login" />
<input type="hidden" name="url" value="/index.php" /><input type="submit"
value="Login" />
</form>
<a href="user.php?op=lostpassscreen&module=NS-LostPassword">Log in
Problems?</a><br> New User? <a href="user.php">Sign Up!</a>
<?php
}
?>

I want the flash to connect to the php page (not launch it) and check the
login... and then if good...advance the movie?

Any idea aout how i can make it in Flash ?

note i'm a total newbie in flash
:(
PoVwer
12/30/2004 2:58:32 PM
On your main timeline you have to have 2 imput text fileds named : userlogin
and userpass
and a submit button named : submitBtn




submitBtn.onRelease = function() { //this is the button named submitBtn
myvar = new LoadVars();
myvar.userlogin = _root.userlogin.text; //this the userlogin named text field
myvar.userpass = _root.userpass.text; //this the userpass named text field
myvar.sendAndLoad("your.php?r="+random(9999), myvar, "POST");
myvar.onLoad = function(success) {
if (success) {
_root.issubmited = this.submited;
}
};
};


here is the your.php code:
<?
$loginname = ereg_replace("&", "%26", $_POST['userlogin']); //$loginname
will have the login name typed into flash
$pass= ereg_replace("&", "%26", $_POST['userpass']); // $pass will
have the password typed into flash
print '&submited=' .$issubmited; //flash will load this to the
_root.issubmited variable if the process vas succesful
?>
Good Luck!
awillys
12/30/2004 3:54:16 PM
Thanks for this.
the thing is that i also need the user information to be checked in my
database then show somthg like "Welcome Username" if login is successfull and a
"wonr username or password Register" if the info are incorrect
AddThis Social Bookmark Button