Amfphp And Flex4.5 Very Simple Login System
I am trying to create a flex login screen and I am submitting my variables via amfphp and when I run this query I get no data returned.
When I pass the values to the amfphp browser, I see that the string is being returned. Can someone explain what I am doing wrong, remember that I am a complete nob.
Errors I have:
(Object) # 0
message = "faultCode: INVALID_AMF_MESSAGE faultString: 'Invalid AMF message' faultDetail: '' Lines: 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;
}
}
source to share
The first thing you need to do is debug traffic with Charles Proxy . I took a quick look at your code and one thing that jumps out at me is that you echo
put a string into your method. amfPHP doesn't like it as it is an output buffering mess. If you remove this echo
, your function should work; it depends on which version of amfPHP you are using.
source to share