A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Please help with a part of pl.script, getting var, to flash..long post

  1. #1
    Junior Member
    Join Date
    Aug 2001
    Location
    sf bay area
    Posts
    20
    HI!!!

    I've found a script that redirects users to an html page that uses a pass word log in combo then opens up a new browser window with their html page. I am new to any cgi scripting and I haven't been able to get the scripts variables to pass to my flash movie. I have two text fields: password and username and a login button that uses "getURL _blank,post" method it's the only way that the script seems to work, it opens new browser window with the form error messages. I know the _blank will open up a new window, .what I am trying to do is get the form error messages in my flash movie , display the error messages in my flash movie, send the right/wrong log in info to the script then after that will a new window will open to the redirected html page.

    I have tried the Load Variables("http://www.mtsite.com/cgi-bin/passwd/login.pl'&form_error=+password(password)','&form_e rror=+username(username)'", "this", "POST
    That won't work too. It's problay the way my AS code is.
    I am very new to scripting(you can problay tell) I will *really* appreciate *any* help with this.

    Thanks,
    stacey

    This is just part of the script, the part that send the error messages.

    The .pl

    code:

    if($ENV{'HTTP_REFERER'} !~ /$ok_login_page/) { print "Content-type: text/html\n\n"; &invalid_referer; }
    &Get_the_Date;
    &parse;

    &form_error("You must enter a user name") unless $FORM{'username'};
    &form_error("You must enter a password") unless $FORM{'password'};


    # Lets open the password file and read in all the usernames and passwords

    open (PASSWORD, "$passwordFile") || &open_error("$passwordFile");
    @lines = <PASSWORD>;
    close (PASSWORD);
    foreach $line (@lines)
    {
    #chop $line;
    ($username, $realpassword, $UserURL) = split(/\+/,$line);
    $pwordlist{$username}=$realpassword;
    $userurlist{$username}=$UserURL;
    $userurlist{$username}=~s/\n//g;
    }


    # If we can't find the username in the file, deny access to the user
    if (!$pwordlist{$FORM{'username'}}){ &form_error("We did not find your user name in our database.<BR>Please check your user name."); }
    # If the user name and password does not match, deny access to the user
    elsif ($FORM{'password'} ne $pwordlist{$FORM{'username'}} ) {&form_error("The password you entered does not match the user name in our database.<BR>Please check your password."); }
    # Now the user is now cleared to proceed
    else{


    ------


    Here's the part that opns up the error browser window:

    Code:

    sub form_error {
    local ($errorname) = @_;
    print "Content-type: text/html\n\n";
    print <<"Close~//~Print";

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
    <HTML>
    <HEAD>
    <title>Form Error</title>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
    <BR>
    <TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 Width="100%">
    <TR>
    <TD BGCOLOR="#D0D8EA">
    <B><FONT SIZE="+3">Form Error</FONT></B>
    </TD>
    </TR>
    </TABLE>
    <P>
    <CENTER>
    <FONT COLOR=FF0000 SIZE="+1">$errorname</FONT>
    <P>
    <FORM>
    <TABLE BORDER=1 BGCOLOR=#FF0000 cellpadding=3 cellspacing=0>
    <TR><TD>
    <input type="button" value="BACK" onClick=history.back()></TD>
    </TR></TABLE>
    </FORM>
    </CENTER>
    <P>
    &nbsp;
    <P>
    </BODY>
    </HTML>
    Close~//~Print
    exit;
    }

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    if you want to retrieve login status in flash, you should replace those html thingies like function form_error with statements like
    sub form_error
    { my $txt = shift;
    print "Contetnt-type: text/htmö\n\n";
    print "status=$txt";
    exit;
    }

    Check the login example at http://www.neuralust.com/~mingdocs

    Musicman

  3. #3
    Junior Member
    Join Date
    Aug 2001
    Location
    sf bay area
    Posts
    20
    thank you for your reply musicman!

    it's still not working ...a new browser window still pops up with the error message in it... i just want error messages to be in my movie. i've tried everything that my limited scripting capabilities permits.

    ive added
    to the sub form area :

    sub form_error {
    "username=$username&password=$password&error=$form _error";
    print "Content-type: text/html\n\n";
    print my $txt = shift;
    print "$form_error";
    exit;




    my flash movie has:
    i have a password field, a username field and a text box named error and a login button which i have:

    on (release) {
    loadVariablesNum("http://www.mysite.com/cgi-bin/passwd/login.pl?action="+_root.error+"&form_error"+"&user name="+_root.username+"&password="+_root.password, _root, "POST");
    }




    thank you music man for your help so far..

    -stacey










  4. #4
    Registered User
    Join Date
    Feb 2001
    Posts
    13,044
    Hi,

    have a look at the login and registration example at http://www.neuralust.com/~mingdocs - there is no fla but a step by step explanation on how the movie and the backend are built.
    One thing for sure: we all use POST, among other things, to hide the password from people that may get at the browser history. It is sending all the current vars to the server, so there is no reason at all to add the vars to the request individually

    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center