1 Reply Latest reply on Mar 25, 2007 3:36 PM by cliffy2009

    PHP, MSSQL 2000, SERVER 2003 and FLEX 2

    cliffy2009
      Hi everyone,
      I tried to connect to MSSQL using PHP. I did not get any error message but the only problem is when I try to test the problem, I get this error message. Everything works fine on my local computer "developer", but when I try to program and test on my Windows Server 2003, I get this error message:
      ReferenceError: Error #1069: Property loginsuccess not found on String and there is no default value.
      at index/::checkLogin()
      at index/__login_user_result()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.rpc.http.mxml::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
      at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler()
      at mx.rpc::Responder/result()
      at mx.rpc::AsyncRequest/acknowledge()
      at ::DirectHTTPMessageResponder/completeHandler()
      at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()

      PHP:
      <?php
      $dbhost='localhost';
      $dbuser='sa';
      $dbpass='S@ue0925';
      $mydb='test';
      $dbconn=mssql_connect($dbhost,$dbuser,$dbpass);
      mssql_select_db($mydb, $dbconn);


      $sql = "SELECT id " .
      "FROM tblusers " .
      "WHERE username = '" . $_POST['username'] . "' " .
      " AND password = '" . $_POST['password'] . "' "
      );
      $result = mssql_query($sql, $dbconn);

      $numRows = mssql_num_rows($result);

      //start outputting the XML

      $output = "<loginsuccess>";

      //if the query returned true, the output <loginsuccess>yes</loginsuccess> else output <loginsuccess>no</loginsuccess>

      if(!$result)

      {

      $output .= "no";

      }else{

      $output .= "yes";

      }

      $output .= "</loginsuccess>";

      //output all the XML

      print ($output);




      ?>

      Can someone please help me?
      Thank you.
      Cliffy
        • 1. Re: PHP, MSSQL 2000, SERVER 2003 and FLEX 2
          cliffy2009 Level 1
          my code
          _____________________
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
          <mx:states>
          <mx:State name="Logged In">
          <mx:SetProperty target="{panel1}" name="width" value="95%"/>
          <mx:SetProperty target="{panel1}" name="height" value="95%"/>
          <mx:RemoveChild target="{password}"/>
          <mx:RemoveChild target="{username}"/>
          <mx:RemoveChild target="{label1}"/>
          <mx:RemoveChild target="{Submit}"/>
          <mx:RemoveChild target="{label2}"/>
          <mx:SetProperty target="{panel1}" name="title" value="Members Section"/>
          <mx:AddChild relativeTo="{panel1}" position="lastChild">
          <mx:Label x="10" y="10" text="Welcome to the Members Section!"/>
          </mx:AddChild>
          <mx:AddChild relativeTo="{panel1}" position="lastChild">
          <mx:Label x="10" y="36" text="Here you can do great things, like join the forums @ Viper Creations!"/>
          </mx:AddChild>
          <mx:AddChild relativeTo="{panel1}" position="lastChild">
          <mx:Label x="10" y="62" text="Label"/>
          </mx:AddChild>
          </mx:State>
          </mx:states>
          <mx:Script>
          <![CDATA[
          import mx.rpc.events.ResultEvent;
          import mx.controls.Alert;
          ]]>
          </mx:Script>
          <mx:Script>


          <![CDATA[

          private function checkLogin(evt:ResultEvent):void
          {

          if(evt.result.loginsuccess == "yes")

          {

          currentState = "Logged In";

          }

          if(evt.result.loginsuccess == "no")

          {

          mx.controls.Alert.show('Invalid username/password');

          }
          }

          ]]>

          </mx:Script>
          <mx:HTTPService id="login_user" result="checkLogin(event)" showBusyCursor="true" method="POST" url=" http://www.phobos-machines.com/login/bin/request.php" useProxy="false">
          <mx:request xmlns="">
          <username>
          {username.text}
          </username>
          <password>
          {password.text}
          </password>
          </mx:request>
          </mx:HTTPService>

          <mx:Panel resizeEffect="Resize" width="250" height="200" layout="absolute" title="Login System" horizontalCenter="0" verticalCenter="-2" id="panel1">
          <mx:Label x="10" y="10" text="Username:" id="label1"/>
          <mx:TextInput x="10" y="36" id="username"/>
          <mx:Label x="10" y="66" text="Password:" id="label2"/>
          <mx:TextInput x="10" y="92" id="password" displayAsPassword="true"/>
          <mx:Button x="10" y="122" label="Submit" id="Submit" click="login_user.send();"/>
          </mx:Panel>






          <!--registraion -->

          <mx:HTTPService id="login" showBusyCursor="true" method="POST" url=" http://www.phobos-machines.com/login/bin/request.php" useProxy="false">
          <mx:request xmlns="">
          <username>
          {username2.text}
          </username>
          <password>
          {password2.text}
          </password>
          </mx:request>
          </mx:HTTPService>

          <mx:Panel x="30" y="10" width="380" height="270" layout="absolute">
          <mx:Form x="10" y="19" width="328" height="187">
          <mx:FormItem label="username">
          <mx:TextInput id="username2" width="100%"/>
          </mx:FormItem>

          <mx:FormItem label="Password">
          <mx:TextInput id="password2" width="100%" displayAsPassword="true"/>
          </mx:FormItem>
          <mx:FormItem>
          <mx:Button label="Submit" click="login.send(),Alert.show('User Registered', 'Registration',mx.controls.Alert.OK);"/>
          </mx:FormItem>
          </mx:Form>
          <mx:FormHeading x="0" y="0" label="Registration"/>
          </mx:Panel>



          </mx:Application>