3 Replies Latest reply on Feb 28, 2010 5:26 PM by FuZZyLoGic0XFF

    I am new on flex, and i would like to create a simple login + password using amfphp


      Hi all,


      I try to make a simple login password using mysql and amfphp, i have a little quesiton, i dont' know how to get back my response from php. Thanks in advance if anyone could help me.


      Best regards


      i would like to tell to the label    <mx:Label x="380" y="10" id="lResponse"/> the response from php

      I juste want to take back response from php.


      Here is my mxml :


      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
                  import mx.controls.dataGridClasses.DataGridColumn;
                  import flash.net.Responder;
                  import mx.events.DataGridEvent;
                  import org.corlan.VOAuthor;
                  private function checkpassword():void {
                      var newauthor:VOAuthor=new VOAuthor();
                      newauthor.lname_aut = nom.text;
                      newauthor.fname_aut = prenom.text;


                  private function checkInput():void
                      if(nom.text == "" || prenom.text == "")
                          lResponse.text = "Veuillez completer tout les champs";
                          lResponse.text = "connecter";
                      //    checkLogin("login.Verify.validate",[nom.text,prenom.text]);
              <!-- Place non-visual elements (e.g., services, value objects) here -->
              <mx:RemoteObject id="myRemote" destination="MyService" source="MyService"
                               endpoint="http://localhost/amfphp/gateway.php" showBusyCursor="true"/>
          <s:Panel x="334" y="168" width="245" height="135" title="Identifiez vous" textAlign="center">
              <s:TextInput x="102" y="10" textAlign="left" id="nom" />
              <s:TextInput x="102" y="40" textAlign="left" id="prenom" />
              <s:RichText x="50" y="6" text="Login :" height="22" width="56" textAlign="left" verticalAlign="bottom"/>
              <s:RichText x="27" y="46" text="Password :" height="20"/>
              <s:Button x="125" y="70" label="Connecter" width="105" click="checkInput()"/>
              <mx:Label x="380" y="10" id="lResponse"/>


      Here is my php code :




      require_once ('./vo/org/corlan/VOAuthor.php');


      //conection info
      define( "DATABASE_SERVER", "");
      define( "DATABASE_USERNAME", "root");
      define( "DATABASE_PASSWORD", "xxxx");
      define( "DATABASE_NAME", "flex360");


      class MyService {




          function validate($author){

              $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);

              $user = $author[0];
              $pass = $author[1];

              $query = "SELECT DISTINCT * FROM authors_aut WHERE fname_aut = '$user' AND lname_aut = '$pass'";
              $rs = mysql_query($query);

              $var = mysql_fetch_assoc($rs);
              $u = $var["fname_aut"];
              $p = $var["lname_aut"];

              if ($pass != $p){
                  $response[0] = "INVALID";
                  $response[1] = "Invalid username and/or password";
              } else {
                  $response[0] = "VALID";
                  $response[1] = "Welcome $u";
              return $response;