A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: Php $_post

  1. #1
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440

    Php $_post

    HI, how to make a form in flash sending login and password over "POST" method to concrete file in PHP?

  2. #2
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    There are two at the Koolmoves Exchange. One is hard coded via PHP (md5 encrypt)...one is via PHP/MySQL(also md5).

  3. #3
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    this not what im looking for. im not using md5, and im not using database :] passwords are stored in text files, with format login.txt -> script opens file, read file login.txt and if password == pasword form file proceeds, else show suitable message. i just need to send login and password to loguj.php script.

  4. #4
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Ooooh. I see. I'm sure someone will help.

  5. #5
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    i saw this post before edit, ill try to use your script, change it, maybe itll work :]

    and... why you put the send script in main timeline, not in button? and next thing is, how to use cookies? Ive wrote other topic for this, but its connected - script makes cookie named 'zalogowany' and containing login. Next script redirects user to index.php from other dir in new window; and changes the main (text) menu form
    Login | Register
    to
    Profile | Notices | PM (number of new messages) | Player | Radio | TV and other links.

    Id like put them in a flash, to buttons. Ive tried to make a html table with them, positio: absolute etc but it requires wmode=transparent. and wmode provides strange behavior in FF - buttons doesnt work in this case.

    So how script can read cookies?

  6. #6
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    ive just found thread about this ill try to resolve it, but still ant help is welcome :]

  7. #7
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    why you put the send script in main timeline, not in button
    Why did I? Dunno man....guess I'm a noob. I'm willing to learn from any examples you make though

  8. #8
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    Code:
    //LoadVar_Mailform for Koolmoves © 2006 Chris Seahorn (http://sandbox.blogdns.com//[email protected])
    
    but1.onPress=function(evt){
     if (login.text == "" || haslo.text == "" ) {
            theresult.gotoAndPlay("go");
                   
        } else {
          var result_lv= new LoadVars();
        result_lv.onLoad = function(success) {
        if (success) {
        login.text="";
        haslo.text="";
                  
        } 
        else { }
        };
        var send_lv = new LoadVars();
        send_lv.action = "send";
        send_lv.login = login.text;
        send_lv.haslo = haslo.text;
        send_lv.sendAndLoad("./rejestracja/loguj.php", result_lv, "POST");
            
        }
    }
    stop();
    ive used this script in a MovieClip. Of course objects haslo, login and but1 exists and field names and variable names are set.

    But script doesnt seem to do anything. Even if user or password arent set, script should prompt a message. But nothing happens.

    So... can i send variables via POST to the file in other directory?

  9. #9
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    It would probobly make more sense to download the LoadVars Login w/SO movie in the Misc section since it is...in fact... a login with username and pass. You can then just direct my submit button to your existing PHP file.

    The http cookie part you are going to have to rely on someone else for. There are a few things I'm refusing to deal with in 2006 and http cookies are one of them since so many people block them. That and the fact they do not work across browsers makes an http cookie about as reliable as Michael Jackson babysitting your four year old son

  10. #10
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    Quote Originally Posted by Chris_Seahorn
    your four year old son
    do you know im 15 years old? My page is designed for a group of people. Only gallery, map and info doesnt require logining. The rest must have cookies enabled. I would have to change about 50 different files to change cookie... to what?

    BTTopic: ive downloaded your file and im working on it :] I REALLY AM a completly noob.. im only asking questions about AS, just trying to help other (with no results). Im daily reading this forum to learn at leasts basics of AS... maybe youll know some good tutorials, teaching how to use AS, flash with PHP...

  11. #11
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    do you know im 15 years old? My page is designed for a group of people. Only gallery, map and info doesnt require logining. The rest must have cookies enabled. I would have to change about 50 different files to change cookie... to what?
    I guessed you were young but that isn't a factor in flash and I try not to treat anyone as a kid just because they are. If you can understand this stuff...you are doing fine I'd say. We have people as young as 10 on this board pounding out flash like the big dogs so age doesn't matter.

    I only mention http cookies to explain why you will never see a submission of mine at the Koolmoves Exchange that supports them. Do people still use them?...sure they do.

    As for tutorials there are a bunch here at Flashkit, places like Actionscript.org and other large flash houses. Bret and a few others are little by little trying their best to get tutorials in place specifically for Koolmoves users but it's a lot of work with (usually) little payoff and definitely a labor of love since they are time consuming and users in this platform offer little to no feedback. It's why I myself have decided to stop submitting to the Exchange.

    From reading your previous posts and threads I see you are jumping right into the most complicated of type of flash...dynamic. That adds to your frustration because you have to deal with the frontend (the flash) and the backend as well (the backend...php...cgi...etc) and then have to make the two interact. For this there are no quick answers or instant knowledge and you have to piece together what you can from what is available. A tough way to start but definitely something that can be done.

  12. #12
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    Quote Originally Posted by Chris_Seahorn
    I guessed you were young but that isn't a factor in flash and I try not to treat anyone as a kid just because they are. If you can understand this stuff...you are doing fine I'd say. We have people as young as 10 on this board pounding out flash like the big dogs so age doesn't matter.
    writing about age i was thinking about what have you said about jackson :] you know, becoming a father at age of 11 isnt a good idea
    Youre saying that you arent treating anoyone as a kid and youre right. Ive read a lot of your posts and i saw how youre trying to help.

    but back to topic. I dont know whats your timezone, but at my clock it is 2:34 after midnight... ill try to do something tommorow (today) morning, ill post back.
    And what about difficulity of what i want to do - ive learned PHP writing a CMS. Now ive wrote another one, based on text files... and i want to do something in flash, something good... lets say, flash CMS huh, why not? ive got all algorithms and almost all php stuff :] based on text files (its quite hard to get cheap server with database in Poland) will be something... nice. Doing that, i want to learn a lot. And this is main target of doing it... U know, learning is learnig, but practice makes perfect :]

    so... c u tommorow :]

    P.S. *c u today

  13. #13
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    That's usually what all my personal Flash websites are...CMS systems. Right now it's the forum because I'm tweaking it but will return to mine once I'm done. I used to distribute them (mainly Swishmax ones) but I decided to not repeat it in this platform and code for personal use only. They are fun and I agree it's a great goal to have. Sleep well Antz! See you soon!

  14. #14
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    So seee you :] and please enter http://www.google.com/codejam/previous.html and look on "cournty": 30 places. 4 Polish. WooHooo :]

  15. #15
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Cool. I guess we all have our heroes. My favorite coder is Bence Toth. He's talented and hands out his code (something you rarely find in the same sentence).

    http://www.csodalatosemberek.hu/

  16. #16
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    im working on it about 5h, and i stil dont know what is wrong. PHP is parsed correctly, and I havent change any codes in flash... ive only changed 1 value, from "username" to login.
    And the flash is still showing "Success!"... can anyone tell me why?
    Attached Files Attached Files

  17. #17
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    allright, i think i did it. But now another question occurs - how to make button disabled when there isnt a cookie? And how to get value from cookie?

    LOL as i said doing big things is good for learning. Now i can understand the code. Today ill try to write some code myself. Well see :]

  18. #18
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    I know this one is just going to gather dust so I guess I'll post.

    Show me how you construct your cookie in your PHP. We need to know that to read the variables (decode) depending on what you name them.

  19. #19
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Forget it...that will take too long.

    If I set a cookie using two variables from an earlier section of the PHP (say after successful registration) named "$username" and "$password" like so:

    Code:
    $expiryDate = mktime(0, 0, 0, 12, 25, 2030);
    setcookie('username' , $username, $expiryDate);
    setcookie('password', $password, $expiryDate);
    I can later decode the cookie in any backend page using:


    Code:
    $user= $_COOKIE["username"];
    $pass= $_COOKIE["password"];
    
    if (!$user) {
    // I can assign a username or really send in any variable (like a flag) I want since they are new
    $user = "Anonymous";
    }
    Same for the password cookie.


    As for buttons.....if using an actual button component you can disable or enable depending on the recieved value (username or flag you determine) in the actionscript when the values are sent in:

    Code:
    if(user=="Anonymous"){
    
    register_btn.enabled=true:
    }

    If you are using somethig other than a button component (clip as button or etc) you can either have it initially be set to invisible (register._visible=false)
    or have it hidden offstage until the value is sent in:

    Code:
    if(user=="Anonymous"){
    
    register._visible=true:
    }

    **As a sidenote**

    A lot of people ask me why I hide things offstage in many of my movies when I can simply use visibilty. I use both methods depending on what is going on but flashplayer is notorious for sometimes dropping the ball on visibility, especially if a lot of things are invisible. Particularly with Mac browsers. Since most of my movies have a lot going on at once I tend to lean towards offstage hiding to make sure there are no holes that may be exploited due to flashplayer problems. Since you have no idea what browser on what system may bugger...I play it safe with certain sections. If you hide offstage you must stay <3000 for an X/Y value (MM recommends). You want to hide it far enough offstage that people with large monitors can't still see it but not too far (>3000) so that flashplayer recognizes it.

  20. #20
    Polak Maly ant_Z's Avatar
    Join Date
    Jul 2006
    Location
    Poland
    Posts
    440
    http://www.wackyweddingsculptures.co.uk/gran.htm

    The person who helped you took sometimes more than an hour to try and solve your problem for free. A "thank you" is always appreciated. So are smilies.
    treat it as a smiley and a big THANK YOU :]

    what about cookies...

    cookie with login: setcookie('zalogowany' , $login, time()+600);
    teachers' cookie: setcookie('teacher' , $login, time()+600);

    script making cookies is attached 4 posts above.

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