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 
$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”);
}
}
**