Flex PHP登录系统无法正常工作

时间:2011-02-23 15:09:51

标签: php flex return echo

我使用flex和php编写了一个登录系统,但由于一些奇怪的原因,php回声都支持“true”和“false”。任何想法为什么会发生这种情况?

<?php
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
//include("connect.php");   // used for your connection to the database.

$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);

// Temp username and password until hooked up to a database.
$strDetails[0] = "dennis";
$strDetails[1] = "test";

// DATABASE WORK HERE (grab the user)
/*<!--
$query = "SELECT username,password from users where username='$username' AND password='$password'";

while ($row = mysql_fetch_array($query)) {  // have not tested yet.
    if ($row['username'] == $username && $row['password'] == md5($password))    // If you don't want encryption take off md5
        echo "<login>true</login>";
    else
        echo "<login>false</login>";
}-->
*/

// Temp until hooked up to a database.
if ($username == $strDetails[0] && $password == $strDetails[1])
    echo "<login>true</login>";
else
    echo "<login>false</login>";

&GT;

1 个答案:

答案 0 :(得分:0)

几个月前我遇到了类似的问题。由于某种原因,我的一个循环没有正确解析。

您可以尝试将Temp登录验证更改为:

// Temp until hooked up to a database.
if (($username == $strDetails[0]) && ($password == $strDetails[1])) {
    echo "<login>true</login>";
} else {
    echo "<login>false</login>";
}

让我知道你是如何继续下去的,如果不解决这个问题,我会挖掘旧的麻烦剧本。