I'm getting some troubs from Flex using AMFPHP remoting. I'll try to
make this as brief as possible. I'm receiving the dreaded
"NetConnection.Call.BadVersion".
It's a simple login service to check a username & password against
the mySQL DB. It works fine if I don't try to encrypt the password
using the mcrypt module. Unfortunately, I NEED to use this
encryption module so that existing users can login using this app.
I've tried about every way I know how....still having problems. I'll
post the code below....please let me know if there's any ideas:
############### START CODE ########################
<?php
include('dbConnectValues.php');
$EnCRYPTEdSECRETkEY = "mySuperSecretKEY";
$alg = MCRYPT_BLOWFISH;
$mode = MCRYPT_MODE_CBC;
$iv = "&%`>";
class VLlogin {
function VLlogin()
{
$this->methodTable = array (
"login" => array (
"description" => "Logs into Vidego Lite!",
"arguments" => array("uName", "pWrd"),
"access" => "remote"),
"encryptText" => array(
"description" => "Encrypts pwd",
"arguments" => array("$someText"),
"access" => "remote")
);
}
function encryptText($someText) {
$encrypted_data = mcrypt_encrypt($alg, $EnCRYPTEdSECRETkEY,
$someText, $mode, $iv);
$plain_text = base64_encode($encrypted_data);
return $plain_text;
}
function login($uName, $pWrd) {
$db_name = dbConnectValues::$database;
$server = dbConnectValues::$dbserver;
$username = dbConnectValues::$username;
$password = dbConnectValues::$password;
$fuser = $uName;
$fpwd = $pWrd;
//$fpwd = base64_encode(base64_encode($fpwd));
$fpwd = encryptText($fpwd);
$connection = @mysql_connect($server,$username,$password) or die
("Cound not connect to database.");
mysql_select_db($db_name, $connection) or die("Could not select
database.");
$sql = "SELECT * FROM users WHERE username = '$fuser' AND password
= '$fpwd'";
$result = mysql_query($sql);
$numRows = mysql_num_rows($result);
if ($numRows > 0) {
$userInfo = mysql_fetch_assoc($result);
//$userInfo["password"] = base64_decode(base64_decode($userInfo
["password"]));
return $userInfo;
} else {
return 'Please ensure your username or password are
correct.';
}
}
}
?>
-Cameron