开发者

Actionscript 2.0, Having a SendAndLoad() function Issue

开发者 https://www.devze.com 2022-12-22 06:19 出处:网络
I have this code: btn_jouer.onRelease = function () { verif = txt_email_user.text; if (txt_email_user.text == \"\")

I have this code:

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开发者_StackOverflow中文版_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
};

The "page_Login" is login.php file on the server, After debugging, the file login.php successfully received Posted data so i got: $_POST['email'] = "what ever you type in swf form";

The login.php processor file:

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;
    }
}

Here above, the $DB->_nr() always returns "0" even the email address exists!

I have tried to create a simple html page having a form with method POST and have a simple input type text with a name="email" When i write my email which is valid in the database and hit submit $DB->_nr() returns 1.

This really is driving me crazy, i'm sure that the email address exists, the login.php page receive posted data "email = validemail@domain.com" from SendAndLoad(); but mysql_num_rows returns 0.

Any one there had the same issue?? Any help would be so much appreciated!

Barry,


Use the following code in PHP to compare the email in both cases: given from flash and from HTML form:

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;
    }
}

if you test for both of the cases, you will be able to compare the two exact forms. I have put "-" in the front and the end of it just to see if there are any whitespaces next to the email value.

Please reply with a compare result. thank you.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号