3 Replies Latest reply on Feb 17, 2010 2:27 PM by kglad

    PHP, XML, AS2 - Login

    TheBrody Level 1

      I'm trying to make a login, I got my mysql database set up and everything. I'm trying to make the php file and XML file at the moment.

       

      I DON'T KNOW IF ANY OF THIS IS RIGHT - I'M NEW TO PHP and XML.

       

      I want it so that when you enter your username and password on flash, it checks it on the database. So I did:


      $user = $_POST[ 'username' ];

      $pass= $_POST[ 'password' ];


      $query = "SELECT * FROM users WHERE username = '$user' and password = '$pass'";

       

      So, I then made a thing so if it finds 1 row, then it changes a boolean from true or false.

       

      $result = mysql_query( $query ) or die( "didn't query" );

      $checklog = false;

      $num = mysql_num_rows( $result );


      if ( $num == 1 ) {

           $checklog = true;

      } else {

           $checklog = false;

      }

       

      Now I'm trying to make the XML. I want it so if the $checklog is equal to true, then it says "Yes". Else, it says "No".

       

      if ( $checklog == true ) {

           echo "Ya";

      } else {

           echo "No";

      }

       

      Thats all I got for now, Is there anything wrong with that?

        • 1. Re: PHP, XML, AS2 - Login
          kglad Adobe Community Professional & MVP

          that looks ok.  you can use:

           

           


          $user = $_POST[ 'username' ];

          $pass= $_POST[ 'password' ];


          $query = "SELECT * FROM users WHERE username = '$user' and password = '$pass'";

           

           

          $result = mysql_query( $query ) or die( "didn't query" );

          $checklog = false;

          $num = mysql_num_rows( $result );


          if ( $num == 1 ) {

               $checklog = true;

          } else {

               $checklog = false;

          }


           

          if ( $checklog) {

               echo "Ya";

          } else {

               echo "No";

          }

           

          • 2. Re: PHP, XML, AS2 - Login
            TheBrody Level 1

            Okay, so for the flash, how would I make it login if the variable for checklog was true?

             

            Thats what I have so far.

             

            var theXML:XML = new XML();
            theXML.ignoreWhite = true;

             


            theXML.onLoad = function() {

             

                }
            }

             

            theXML.load("MYLINK");

            • 3. Re: PHP, XML, AS2 - Login
              kglad Adobe Community Professional & MVP

              is all the php you showed in one script?