FlashMX,PHP and a login system

I tried the tutorial which is about Flash, PHP and a login system. However i cant get the system to work.

The usercheck.php included in the zip file generated these errors:

**Notice: Undefined index: newUser in C:\Program Files\Apache Group\Apache2\htdocs\Flash\usercheck.php on line 20

Notice: Undefined index: passOne in C:\Program Files\Apache Group\Apache2\htdocs\Flash\usercheck.php on line 21

Notice: Undefined index: passTwo in C:\Program Files\Apache Group\Apache2\htdocs\Flash\usercheck.php on line 22

Notice: Undefined variable: REQUEST_METHOD in C:\Program Files\Apache Group\Apache2\htdocs\Flash\usercheck.php on line 33

Notice: Undefined variable: result in C:\Program Files\Apache Group\Apache2\htdocs\Flash\usercheck.php on line 53**

And when i try to login using the flash it hangs at “Logging in please wait”

Anyone have any idea what went wrong?
Is it because i used FLash Mx 2004 Professional??? or??

well … i don´t think it is from flash mx 2004 … but could you please post the usercheck.php source please … i might help you more if i spot the error :wink:

newlogin.php this is the file that process the login

<?
//this pulls the variables from the flash movie when the user
//hits submit. Use this when your global variables are off.
//I don’t know how to toggle global variables, so I just put
//it in all the time :wink:
$user=$_POST[‘user’];
$pass=$_POST[‘pass’];

//connect to database
if ($user && $pass){
mysql_pconnect(“localhost”,“sa”,“bird1985”) or die (“didn’t connect to mysql”);
mysql_select_db(“mysql”) or die (“no database”);
//make query
$query = “SELECT * FROM auth WHERE username = ‘$user’ AND userpassword = ‘$pass’”;
$result = mysql_query( $query ) or die (“didn’t query”);

//see if there’s an EXACT match
$num = mysql_num_rows( $result );
if ($num == 1){
print “status=You’re in&checklog=1”;
} else {
print “status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2”;
}
}
?>

Usercheck.php the file which lets u submit new users and check the users in the database

<html>
<head>
<title>Database Insert Form for kirupa</title>
</head>
<body bgcolor="#FFFFFF">
<h1>Insert Into Database � UCS</h1>

<form action=“usercheck.php” method=“POST”>
New User Name:       <input name=“newUser” type=“text” style=“background-color: cyan;” size=“20”>
<br>
New User Password: <input type=“text” size=“20” name=“passOne” style=“background-color: cyan;”><br>
Verify Password:       <input type=“text” size=“20” name=“passTwo” style=“background-color: cyan;”><br>
<input type=“submit” value=“Add User” style=“background-color: cyan;”>
</form>

<?PHP

$newUser = $_POST[“newUser”];
$passOne = $_POST[“passOne”];
$passTwo = $_POST[“passTwo”];

if ($passOne == $passTwo) {
$newPass = $passOne;

} else {
print “Passwords mismatched”;
}

if ($REQUEST_METHOD==‘POST’) {
for(reset($HTTP_POST_VARS);
$key=key($HTTP_POST_VARS);
next($HTTP_POST_VARS)) {
$this = addslashes($HTTP_POST_VARS[$key]);
$this = strtr($this, “>”, " ");
$this = strtr($this, “<”, " ");
$this = strtr($this, “|”, " ");
$$key = $this;
}
if ($newUser && $newPass ) {
$query = "insert into auth (userid,username,userpassword) ";
$query .= “VALUES(0000,’$newUser’,’$newPass’)”;
mysql_connect(“localhost”,“sa”,“bird1985”)
or die(“Unable to connect to SQL server”);
mysql_select_db(“mysql”) or die(“Unable to select database”);
$result = mysql_query($query) or die(“Insert Failed!”);
}
}

if ($result){
print “You have successfully entered “.$newUser.” with the password of “.$newPass.” to your database!!”;
}
?>
<br><br>

<hr>
<?
$queryb=“SELECT COUNT(*) FROM auth”;
mysql_connect(“localhost”,“sa”,“bird1985”)
or die(“Unable to connect to SQL server”);
mysql_select_db(“mysql”) or die(“Unable to select database”);
$numusers=mysql_query($queryb) or die (“Select Failed - count”);
$numuser=mysql_fetch_array($numusers);
?>
<h3>Current Users in Database</h3>
<p>
    There are <? echo $numuser[0]; ?> current users in database.<br>
    Listed in alphabetical order by user’s name:<br>
<br>

<?
$queryc=“SELECT * FROM auth ORDER BY username”;

$userlist=mysql_query($queryc) or die(“Select Failed - users”);

?>
<center>
<table border=“1” bordercolor="#000000">
<tr>
<td width=“20%” bgcolor="#000000">
<font size=“2” color="#FFFFFF"><center>
USERS
</font></center>
</td>
<td width=“20%” bgcolor="#000000">
<font size=“2” color="#FFFFFF"><center>
PASSWORDS
</font></center>
</td>
</tr>
<?
while ($userinfo = mysql_fetch_array($userlist)){
?>
<tr>
<td width=“20%” bgcolor="#FFCC33">
<center>
<? echo $userinfo[‘username’]; ?>
</center>
</td>
<td width=“20%” bgcolor="#FFCC33">
<center>
<? echo $userinfo[‘userpassword’]; ?>
</center>
</td>
</tr>
<? } ?>

</table>
</center>
<p>
With this form, you can submit new users and passwords. However, you are not able to update or erase enteries once
entered. All changes made to your database are updated in real time.
<br><br><br>
<small>
© 2003<a href=“http://www.tempethunderpress.com” target=“blank”> � Tempe Thunder Press �</a> All Rights Reserved
</small>
</body>
</html>

other than these 2 files is the flash file which passes the variables from the flash to the php file. Somehow i dont think the variables get passed out because it always stop at the “Logging In please wait…” heres the script:

**//this will be the action to get your variables from the PHP
on (release, keyPress “<Enter>”) {
//checks to see if there is something in both the name
//and password
if (user != “” && pass != “”) {
status = “Begin Login Process - Wait…”;
//if you changed the php file name, change it here to!!
loadVariablesNum(“newlogin.php”, 0, “POST”);
}
}
**