【问题标题】:Actionscript 2.0, Having a SendAndLoad() function IssueActionscript 2.0,具有 SendAndLoad() 函数问题
【发布时间】:2011-01-25 18:58:58
【问题描述】:

我有这个代码:

btn_jouer.onRelease = function ()
{
    verif = txt_email_user.text;
    if (txt_email_user.text == "")
    {
        txt_erreur.textColor = 16724736;
        txt_erreur.text = "Champ(s) manquant(s)";
    }
    else if (verif.indexOf("@", 0) == -1 || verif.indexOf(".", 0) == -1)
    {
        txt_erreur.textColor = 16724736;
        txt_erreur.text = "Adresse E-mail invalide";
    }
    else
    {
        php_login = new LoadVars();
        php_login.email = txt_email_user.text;
        php_login.sendAndLoad(_root.page_Login, php_login, "POST");
        php_login.onLoad = function(succes)
        {
            if (succes)
            {
        //txt_erreur.text = php_login.etat;
        //return;
                if (php_login.etat == "exist")
                {
                    _root.var_user.id = php_login.id;
                    _root.var_user.nom = php_login.nom;
                    _root.var_user.prenom = php_login.prenom;
                    _root.var_user.score = php_login.score;
                    _root.MovieLogin.unloadMovie();
                    if (_root._root.selectedPhone == "KS360")
                    {
                        _root.gotoAndStop(4);
                    }
                    else
                    {
                        _root.gotoAndStop(3);
                    } // end else if
                }
                else if (php_login.etat == "non")
                {
                    trace (php_login.etat);
                    txt_erreur.text = "Email non enregistré! veuillez vous s'inscrir";
                } // end if
            } // end else if
        };
    } // end else if
};

“page_Login”是服务器上的 login.php 文件, 经过调试,login.php文件成功接收到Posted数据,得到: $_POST['email'] = "你用 swf 格式输入什么";

login.php 处理器文件:

if(isset($_REQUEST['email'])){
    $email = strtolower(addslashes($_REQUEST['email']));
    $DB->_request("select * from gamers where email='$email'");
    if($DB->_nr() > 0) {
        $row = mysql_fetch_array($DB->Result);
        echo "&etat=exist&nom={$row['nom']}&prenom={$row['prenom']}&score={$row['score']}";
        //
        exit;
    }
    else {
        echo "&etat=non";
        exit;
    }
}

在上面,即使电子邮件地址存在,$DB->_nr() 也总是返回“0”!

我尝试创建一个简单的 html 页面,该页面具有一个带有方法 POST 的表单,并具有一个简单的输入类型文本,名称为“电子邮件” 当我编写在数据库中有效的电子邮件并点击提交时,$DB->_nr() 返回 1.

这真的让我发疯,我确定电子邮件地址存在,login.php 页面从 SendAndLoad() 接收发布的数据“email = validemail@domain.com”;但 mysql_num_rows 返回 0。

有人遇到同样的问题吗?? 任何帮助将不胜感激!

巴里,

【问题讨论】:

    标签: php mysql xml flash actionscript


    【解决方案1】:

    在 PHP 中使用以下代码比较两种情况下的电子邮件:从 flash 和 HTML 表单给出:

    if(isset($_REQUEST['email'])){
        //createa the testFile.txt and give it attributes with 0777 for permission (in case you are under linux)
        $myFile = "testFile.txt";
        $fh = fopen($myFile, 'a') or die("can't open file");
        fwrite($fh, "-".$_REQUEST['email']."-\r\n");
        fclose($fh);
    
        $email = strtolower(addslashes($_REQUEST['email']));
        $DB->_request("select * from gamers where email='$email'");
        if($DB->_nr() > 0) {
            $row = mysql_fetch_array($DB->Result);
            echo "&etat=exist&nom={$row['nom']}&prenom={$row['prenom']}&score={$row['score']}";
            //
            exit;
        }
        else {
            echo "&etat=non";
            exit;
        }
    }
    

    如果您对这两种情况进行测试,您将能够比较这两种确切的形式。我把“-”放在前面和结尾,只是为了看看电子邮件值旁边是否有空格。

    请回复比较结果。谢谢。

    【讨论】:

      猜你喜欢
      • 2011-02-25
      • 2021-02-09
      • 2016-03-18
      • 2010-10-21
      • 2011-08-31
      • 1970-01-01
      • 2016-08-04
      • 2012-06-24
      • 1970-01-01
      相关资源
      最近更新 更多