0 Replies Latest reply on Jul 29, 2009 6:53 AM by mach6ix

    Client Login Woes - PHP/mySQL - Actionscript 2

    mach6ix

      Hi everyone,

      I have followed the "client login" tutorial found through Kirupa via http://www.kirupa.com/developer/acti...entication.htm

      After completing the tutorial, I found that it's simply not moving forward from the login.php file.

      I have attached the FLA/PHP files in a zip file for review and I would like to thank you in advance for taking the time to read my post and possibly provide some feedback.

       

      Additionally, I have found the included SQL table creation command provides the error #1067 - Invalid default value for 'userid'

       

      I have had a collegue manually create a table for me of which did not error upon creation however i'm unsure if it's useable as it appears the FLASH file is not moving beyond the PHP file as per the message viewed in the status window.

       

      Any help that could be provided would be increadably appreciated.

       

      Thanks,

       

      Mike (mach6ix)

       

       

       

      Submit Button Actionscript (v2.0)


      //this will be the action to get your variables from the PHP
      on (release, keyPress "<Enter>") {
         
          //checks to see if there is something in both the name
          //and password
          if (user != "" && pass != "") {
              status = "Verifying User Information...one moment please.";
             
              //if you changed the php file name, change it here to!!
              loadVariablesNum("newlogin.php", 0, "POST");
          }
      }

       

      SQL Table Creation Command for Table "auth"


      CREATE TABLE auth (
        userid
          int(4)
          unsigned
          zerofill
          DEFAULT '0000'
          NOT NULL
          auto_increment,
        username varchar(20),
        userpassword varchar(20),
        PRIMARY KEY (userid)
      );


      PHP File


      <?
      //this pulls the variables from the flash movie when the user
      //hits submit.  Use this when your global variables are off.
      //I don't know how to toggle global variables, so I just put
      //it in all the time
      $user=$_POST['user'];
      $pass=$_POST['pass'];


      //connect to database
      if ($user && $pass){
          mysql_pconnect("localhost","root","m2j4v8") or die ("didn't connect to mysql");
          mysql_select_db("yourdatabase") or die ("no database");
      //make query
      $query = "SELECT * FROM yourtable WHERE username = '$user' AND userpassword = '$pass'";
      $result = mysql_query( $query ) or die ("didn't query");


      //see if there's an EXACT match
      $num = mysql_num_rows( $result );
      if ($num == 1){
          print "status=You're in&checklog=1";
          } else {
          print "status=Sorry, but your user name and password did not match a user name/password combination in our database.  Usernames and passwords are entered in from a different file.  Thank you for visiting test login script!!&checklog=2";
      }
      }


      ?>