简体   繁体   中英

Amfphp And Flex4.5 very simple login system

I am trying to create a login screen in flex and I am sending my variables through amfphp and when I run this query I get no returned data.

When I pass values to the browser of amfphp I can see that a row is returned. Can someone explain what I'm I doing wrong keep in mind that I am a total noob.

The errors that I have are:

(Object)#0
message = "faultCode:INVALID_AMF_MESSAGE faultString:'Invalid AMF message' faultDetail:'' Rows:1
''"
name = "Error"
rootCause = (null)

<?php
    require('connection.php');

    class NotWorking {

        private $dbc;

        public function __construct(){
            $this->dbc = @mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME) OR DIE (mysqli_connect_error() );
        }

        public function no ($someVar) {
            $data = array();
            $password = mysqli_real_escape_string($this->dbc,trim($someVar['password']));
            $email= mysqli_real_escape_string($this->dbc,trim($someVar['email']));
            $query = "SELECT * FROM users WHERE email='$email' AND password='$password'";
            $r= mysqli_query($this->dbc,$query);

            /*
            if($r){
                echo ' query works ';
                var_dump($r);
            }else{ 
                echo 'Does not work';
            }
            */

            $num = mysqli_num_rows($r);
            echo "'Rows: $num'";

            if ($num > 0 )
                while ($row = mysqli_fetch_array($r) ){
                    $data[] = $row;
                }
            return $data;
        }
    }

First thing you should do is to debug the traffic with Charles Proxy . I've had a brief look at your code and the one thing that jumps out at me is that you're echo ing a string in your method. amfPHP doesn't like this as it messes with the output buffering. If you remove that echo , your function should work; it depends on which version of amfPHP you're using.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM