Ok this will be a very long Post
I hope to help other as well.
I have my flash 8 file that has frames labeled for user auth.
Action Scrip is 2.0
My php
config.php
functions.php
user.php
I am not getting data to the mysql.
and returning member is logged in frame with any user input.
HELP
config.php file with out my login

sorry my eyes only
<?php
// no cache
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// displays only errors
error_reporting(E_ERROR);
// mysql connection variables
$host = 'mysql4.000webhost.com';
$dbuser = 'my_user';
$dbpass = 'my_password';
$dbname = 'my_name';
$table = 'tutorial_user';
// connect to db
$db = @mysql_connect($host,$dbuser,$dbpass) or die("error=could not connect to $host");
$db = mysql_select_db($dbname);
if(!$db)
{
print "error=could not connect to $dbname table";
exit;
}
?> here is the <b>Functions.php</b> file
<?php
function valid_email($email){
// check if email is valid
if( !eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"
."@([a-z0-9]+([\.-][a-z0-9]+))*$",$email, $regs)){
return false;
} else if( gethostbyname($regs[2]) == $regs[2] ){
// if host is invalid
return false;
} else {
return true;
}
}
function valid_userName($name){
// check valid input name
if(!eregi("^[a-z0-9]{8,15}$",$name)){
return false;
} else {
return true;
}
}
function valid_password($pwd){
// check valid password
if(!eregi("^[a-z0-9]{6,8}$",$pwd))
{
return false;
} else {
return true;
}
}
?> and the meats.
user.php
<?php
require_once('config.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";
}
}
// ---
// login, check user
// ---
function login($username,$pass)
{
GLOBAL $db,$table;
$username = trim($username);
$pass = md5(trim($pass));
$query = mysql_query("SELECT * FROM $table WHERE userName = '$username' AND userPassword = '$pass'");
return mysql_num_rows($query);
}
// ---
// forget password
// ---
function forget($email)
{
GLOBAL $db,$table;
$email = trim($email);
$query = mysql_query("SELECT userName, userQuestion from $table WHERE userMail = '$email'");
if(mysql_num_rows($query)<1)
{
return "error=email not present into database";
}
$row = mysql_fetch_array($query);
return "userName=$row[userName]&userQuestion=" . stripslashes($row['userQuestion']);
}
// ---
// generate new password
// ---
function new_password($username,$email,$answer)
{
GLOBAL $db,$table;
$username = trim($username);
$email = trim($email);
$answer = addslashes(trim($answer));
$query = mysql_query("SELECT * FROM $table WHERE userName = '$username' AND userMail = '$email' AND userAnswer = '$answer'");
if(mysql_num_rows($query) < 1)
{
return "error=wrong answer";
}
$rand_string = '';
// ---
// generating a random 8 chars lenght password
// ---
for($a=0;$a<7;$a++)
{
do
{
$newrand = chr(rand(0,256));
} while(!eregi("^[a-z0-9]$",$newrand));
$rand_string .= $newrand;
}
$pwd_to_insert = md5($rand_string);
$new_query = mysql_query("UPDATE $table SET userPassword = '$pwd_to_insert' WHERE userName = '$username' AND userMail = '$email'");
if(!$new_query)
{
return "error=unable to update value";
}
return "userName=$username&new_pass=$rand_string";
}
// ---
// decisional switch
// ---
if(isset($HTTP_POST_VARS["action"]))
{
switch($HTTP_POST_VARS["action"])
{
case "register":
$result = register($HTTP_POST_VARS['username'],$HTTP_POST_VARS['pass'],$HTTP_POST_VARS['email'],$HTTP_POST_VARS['question'],$HTTP_POST_VARS['answer']);
print $result;
break;
case "login":
$result = login($HTTP_POST_VARS['username'],$HTTP_POST_VARS['pass']);
print "user=" . $result;
break;
case "forget":
$result = forget($HTTP_POST_VARS['email']);
print $result;
break;
case "new_password":
$result = new_password($HTTP_POST_VARS['username'],$HTTP_POST_VARS['email'],$HTTP_POST_VARS['answer']);
print $result;
break;
}
}
?>you can view example here
http://streaminternetaccess.com/user_auth.htmlI can send you the flv file to look at the AS in frames.
please help.
here is the AS
this is on the Login Frame
_global.php_file = "user.php";
Stage.scaleMode = 'noscale';
userName.background = true;
userName.backgroundColor = 0xFFFFFF
userName.border = true
userName.borderColor = 0x666666
userPassword.background = true;
userPassword.backgroundColor = 0xFFFFFF
userPassword.border = true
userPassword.borderColor = 0x666666
userName.restrict = "a-zA-Z0-9"
userPassword.restrict = "a-zA-z0-9";
stop();this is on the new_user Frame
stop();
userName.background = true;
userName.backgroundColor = 0xFFFFFF
userName.border = true
userName.borderColor = 0x666666
userPassword2.background = true;
userPassword2.backgroundColor = 0xFFFFFF
userPassword2.border = true
userPassword2.borderColor = 0x666666
userPassword.background = true;
userPassword.backgroundColor = 0xFFFFFF
userPassword.border = true
userPassword.borderColor = 0x666666
userMail.background = true;
userMail.backgroundColor = 0xFFFFFF
userMail.border = true
userMail.borderColor = 0x666666
secretQuestion.background = true;
secretQuestion.backgroundColor = 0xFFFFFF
secretQuestion.border = true
secretQuestion.borderColor = 0x666666
secretAnswer.background = true;
secretAnswer.backgroundColor = 0xFFFFFF
secretAnswer.border = true
secretAnswer.borderColor = 0x666666
userName.restrict = "a-zA-Z0-9"
userPassword.restrict = "a-zA-z0-9";
userPassword2.restrict = "a-zA-z0-9";other frame forms alike.