Hi guys...
I have a simple Flash and PHP registration code with database set up locally on 'wamp'.Database works absolutely fine on a local system. However when I try to submit a simple registration from Flash it doesn't send anything at all. Here are 2 files to look at. Any ideas ? Regards.
And Flash one:
I have a simple Flash and PHP registration code with database set up locally on 'wamp'.Database works absolutely fine on a local system. However when I try to submit a simple registration from Flash it doesn't send anything at all. Here are 2 files to look at. Any ideas ? Regards.
Code:
<?php
require_once('conf.inc.php');
require_once('functions.php');
// ---
// register new user
//
function register($username,$pass,$email,$question,$answer)
{
GLOBAL $db, $table;
$username = trim($username);
$pass = trim($pass);
$email = trim($email);
$question = addslashes(trim($question));
$answer = addslashes(trim($answer));
$validEmail = valid_email($email);
$validName = valid_userName($username);
$validPass = valid_password($pass);
if(!$validName) return "error=invalid name";
if(!$validPass) return "error=invalid password";
if(!$validEmail) return "error=invalid email";
$pass = md5(trim($pass));
// all checks ok
$query = mysql_query("INSERT INTO $table(userName,userPassword,userMail,userQuestion,userAnswer) VALUES
('$username','$pass','$email','$question','$answer')");
if(!$query)
{
return "error=" . mysql_error();
} else {
return "user=ok";
}
}
?>
And Flash one:
Code:
on (release) {
errorMsg.text = ''
if((userName.length > 7 && userName.length < 16)
&& (userPassword.text == userPassword2.text)
&& (userPassword.length > 5 && userPassword.length < 9)
&& (userMail.length > 0)
&& (secretQuestion.length > 0)
&& (secretAnswer.length > 0))
{
var regVars = new LoadVars();
regVars.action = 'register';
regVars.username = userName.text;
regVars.pass = userPassword.text;
regVars.email = userMail.text;
regVars.question = secretQuestion.text;
regVars.answer = secretAnswer.text;
regVars.sendAndLoad(php_file, regVars,'POST');
registerBtn.enabled = false;
regVars.onLoad = function()
{
if(this.error != undefined)
{
errorMsg.text = this.error;
} else {
_root.gotoAndStop('new_ok');
}
registerBtn.enabled = true;
}
}
}