从 httpservics 获取未处理的 php 作为结果 FB4

发布于 2024-11-30 08:51:49 字数 1913 浏览 1 评论 0原文

您好,请帮忙,我在 flash builder 4 中使用 httpservice 作为登录系统,但我从服务器得到的结果是原始 php 未处理的数据,但是当我在浏览器中运行相同的文件时,我得到了一个正确的 xml 文件,我使用 MAMP, 请帮忙,不知道这里有什么问题是 php 代码:

    <?php

define( "DATABASE_SERVER", "localhost:8888" );
  define( "DATABASE_USERNAME", "root" );
  define( "DATABASE_PASSWORD", "root" );
  define( "DATABASE_NAME", "touch" );

//connect to the database
  $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die(mysql_error());

//select the database
  mysql_select_db( DATABASE_NAME );

//These are the variables that Flex is passing to PHP
  $username = mysql_real_escape_string($_POST["username"]);
  $password = mysql_real_escape_string($_POST["password"]);
  $logincookie = mysql_real_escape_string($_POST["logincookie"]);

//Check the credentials
  $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
  $result = mysql_fetch_array(mysql_query($query));

//Output the returned query in XML: If returned false output 0 else output the users id
$output = "<?xml version='1.0' encoding='utf-8'?>";
  $output .= "<loginsuccess>";
  if(!$result)
  {
  $output .= $username;
  }else{
  $output .= $username;
  }
  $output .= "</loginsuccess>";

//Output the User Type
  $usrtyp .= "<usertype>";
  $usrtyp .= $result['user_type'];
  $usrtyp .= "</usertype>";

//output all the XML

print ($output);
  print ($usrtyp);

?>

这是请求:

<s:HTTPService id="login_user" result="checkLogin(event)" showBusyCursor="true" method="POST"
                   url="login.php" useProxy="false">
        <s:request xmlns="">
            <username>
                {username.text}
            </username>
            <password>
                {password.text}
            </password>
        </s:request>
    </s:HTTPService>

Hello pleassse help am using httpservice in flash builder 4 for a login system, but am getting the result as raw php unprocessed data from server, but when i run the same file in the browser i get a correct xml file am using MAMP,
PLEASE HELP donno what's the problem here is the php code :

    <?php

define( "DATABASE_SERVER", "localhost:8888" );
  define( "DATABASE_USERNAME", "root" );
  define( "DATABASE_PASSWORD", "root" );
  define( "DATABASE_NAME", "touch" );

//connect to the database
  $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die(mysql_error());

//select the database
  mysql_select_db( DATABASE_NAME );

//These are the variables that Flex is passing to PHP
  $username = mysql_real_escape_string($_POST["username"]);
  $password = mysql_real_escape_string($_POST["password"]);
  $logincookie = mysql_real_escape_string($_POST["logincookie"]);

//Check the credentials
  $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";
  $result = mysql_fetch_array(mysql_query($query));

//Output the returned query in XML: If returned false output 0 else output the users id
$output = "<?xml version='1.0' encoding='utf-8'?>";
  $output .= "<loginsuccess>";
  if(!$result)
  {
  $output .= $username;
  }else{
  $output .= $username;
  }
  $output .= "</loginsuccess>";

//Output the User Type
  $usrtyp .= "<usertype>";
  $usrtyp .= $result['user_type'];
  $usrtyp .= "</usertype>";

//output all the XML

print ($output);
  print ($usrtyp);

?>

and here is the request :

<s:HTTPService id="login_user" result="checkLogin(event)" showBusyCursor="true" method="POST"
                   url="login.php" useProxy="false">
        <s:request xmlns="">
            <username>
                {username.text}
            </username>
            <password>
                {password.text}
            </password>
        </s:request>
    </s:HTTPService>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黎夕旧梦 2024-12-07 08:51:49

我大胆猜测您不是在 HTTP 服务器上运行它,而只是引用文件系统上的 html/swf 文件本身,因此 PHP 没有被处理。

I'm going with a wild guess that you're not running this off of an HTTP server, but just referencing to the html/swf file itself on your filesystem, hence the PHP is not being processed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文