Computing.Net > Forums > Programming > PhP and ACTION script

PhP and ACTION script

Reply to Message Icon

Original Message
Name: beier
Date: January 17, 2004 at 15:59:50 Pacific
Subject: PhP and ACTION script
OS: xp
CPU/Ram: nam
Comment:

well, ok, wow, here we go.
I've been trying to make a good secure flash login. That is, a flash movie that has a user and passwords fields, and a button, so people can log in.

It will suposedly input a username and pass from the user, send that to a php document on my server, and that php document will return either "true" or "false" depending if the user and pass are valid, then the flash movie will either deny access to the user, or grant it.

here's my flash action script so far :

stop();
tmpuser = textfield1.text;
tmppass = textfield2.text;
url = "http://eric.drastic-creations.com/private/nick-php/flash/authen/authen.php?user="+tmpuser+"&pass="+tmppass;
function submit() {
loadVariables(url, 0, "GET");
if (yn == 1) {
gotoAndStop(50);
}
if (yn == 0) {
gotoAndPlay(5);
}else{
gotoAndPlay(60);
}
}

-

and here's my php script :


<?php


import_request_variables("P");
$_POST['text'];

$users = array( 0=>"eric",
1=>"nick",
2=>"anonymous");

$passs = array( 0=>"1337",
1=>"1337",
2=>"guest");

for ($x = 0; $x < 3; $x++) {
if ( ($user == $users[$x]) && ($pass == $passs[$x]) ) {

$yn = "true";
}
}

if ($yn == "true") {
echo 'yn=1';
}else{
echo 'yn=0';
}

?>

I think that it should work! but it dosn't! for those who know php and action script both together, you are a rare breed and your help is much appriciated. thank you.


Report Offensive Message For Removal


Response Number 1
Name: lak
Date: January 17, 2004 at 19:28:51 Pacific
Reply: (edit)

Try comparing your username and password values with the php strcmp function.

It takes two string parameters and compares them. It will returns 0 if the values are the same. I'm not sure how it handles case-sensitivity, but there is also a strtoupper function which takes one string parameter and returns the string in upper case.

More information about the functions can be found at http://www.php.net

-Lak


Report Offensive Follow Up For Removal

Response Number 2
Name: beier
Date: January 19, 2004 at 07:06:02 Pacific
Reply: (edit)

Hey thanks Lak. I think that'll work, but it won't make the entire login work. I've testesd the php script by itself, and it returns values just fine. The problem is that my Flash movie isn't recognizing the variables. Not importing them correctly.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: PhP and ACTION script

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge