Android SDK Dialog Bug

时间:2015-07-26 11:05:51

标签: php android dialog

我正在开发登录和注册应用程序。 我的问题是错误警报显示是否有错误或注册成功。所以我不知道错误在哪里。

代码:

var buffer: [UInt8] = [0, 1, 2]
yourObject.push(UnsafeMutablePointer<UInt8>(buffer), length: Int32(buffer.count))

1 个答案:

答案 0 :(得分:0)

这是输出:

07-26 14:58:52.326    1902-2286/test.test.com.test I/System.out﹕ Response : ERROR
07-26 14:58:52.447    1902-1929/test.test.com.test W/EGL_emulation﹕ eglSurfaceAttrib not implemented
07-26 14:58:52.447    1902-1929/test.test.com.test W/OpenGLRenderer﹕ Failed to set EGL_SWAP_BEHAVIOR on surface 0xa5ba7520, error=EGL_SUCCESS

但用户已注册。 PHP代码是:

<?php require("../login/common.php");
    $message = '';
    $signup = "false";
    if(!empty($_POST)) 
    { 
        if(empty($_POST["firstname"]) or empty($_POST["lastname"]) or empty($_POST["password"]) or empty($_POST["passwordconfirm"]) or empty($_POST["birth"])) {
        die("ERROR");
    }
    elseif(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) 
    { 
        die("ERROR");
    }
    elseif($_POST["password"] == $_POST["passwordconfirm"]) {
        $password = test_input($_POST["password"]);
        $cpassword = test_input($_POST["passwordconfirm"]);
        if (strlen($_POST["password"]) <= '5') {
            die("Password to short(min. 6)");
        }
    }
    elseif(!empty($_POST["password"])) {
        die("ERROR");
    }
    $signup = "true";
    if($signup == "true") { 


        $query = " 
            SELECT 
                1 
            FROM users 
            WHERE 
                email = :email 
        "; 

        $query_params = array( 
            ':email' => $_POST['email'] 
        ); 

        try 
        { 
            $stmt = $db->prepare($query); 
            $result = $stmt->execute($query_params); 
        } 
        catch(PDOException $ex) 
        { 
           //normaly die("ERROR") but this is one of the mistackes
        } 

        $row = $stmt->fetch(); 

        if($row) 
        { 
        } 

        $query = " 
            INSERT INTO users ( 
                username, 
                password, 
                salt, 
                email,
                gender,
                birthday
            ) VALUES ( 
                :username, 
                :password, 
                :salt, 
                :email,
                :gender,
                :birthday
            ) 
        "; 
        $salt = dechex(mt_rand(0, 2147483647)) . dechex(mt_rand(0, 2147483647)); 
        $password = hash('sha256', $_POST['password'] . $salt); 
        for($round = 0; $round < 65536; $round++) 
        { 
            $password = hash('sha256', $password . $salt); 
        }
        $gender = $_POST['gender'];
        $birthday = $_POST['birth'];
        $username = $_POST['firstname'] . " " . $_POST['lastname'];
        $query_params = array(
            ':username' => $username, 
            ':password' => $password, 
            ':salt' => $salt, 
            ':email' => $_POST['email'],
            ':gender' => $gender,
            ':birthday' => $birthday
        ); 
        try 
        {
            $stmt = $db->prepare($query); 
            $result = $stmt->execute($query_params);
        } 
        catch(PDOException $ex) 
        {  
           //normaly die("ERROR") but this is one of the mistackes
        }
        if($signup == "true") {
            $result = mysql_query("SELECT * FROM users");
            $num_rows = mysql_num_rows($result);
            mkdir("C:/xampp/htdocs/Users/" . $_POST['email']);
            $src = "C:/xampp/htdocs/Users/Sample";
            $dst = "C:/xampp/htdocs/Users/" . $_POST['email'];
            xcopy($src,$dst);
            $savemodi = $_POST["savemodi"];
            if($savemodi == true) {
                $saveinfopath = "C:/xampp/htdocs/Users/" . $_POST['email'] . "/";
                $file = fopen($saveinfopath . $savemodi . "/infos.txt","w");
                $userinfos = fwrite($file,$username . "°" . $_POST['email'] . "°" . $gender . "°" . $birthday . "°" . $result['id']);
                fclose($file);
                $saveinfopath = "C:/xampp/htdocs/Users/" . $_POST['email'] . "/";
                $file = fopen($saveinfopath . "public/infos.txt","w");
                $userinfos = fwrite($file,$username . "°°°°" . $result['id']);
                fclose($file);
            } else {
                $saveinfopath = "C:/xampp/htdocs/Users/" . $_POST['email'] . "/";
                $file = fopen($saveinfopath . $savemodi . "/infos.txt","w");
                $userinfos = fwrite($file,$username . "°" . $_POST['email'] . "°" . $gender . "°" . $birthday . "°" . $result['id']);
                fclose($file);
                $saveinfopath = "C:/xampp/htdocs/Users/" . $_POST['email'] . "/";
                $file = fopen($saveinfopath . "private/infos.txt","w");
                $userinfos = fwrite($file,$username . "°" . $_POST['email'] . "°" . $gender . "°" . $birthday . "°" . $result['id']);
                fclose($file);
            }
        die("Success");
    } else {
      die("ERROR");
    }?>

所以我在PHP代码中用错误标记了ERRORS。