Problem with my login screen
I created a mysql database, a connection in Dreamweaver, and a login page using the tutorials here on the Adobe site. I thought I had followed everything according to the tutorials, using the "server behaviors" as instructed, but when I try to execute it, I get the following error:
Warning: mysql_select_db() expects parameter 2 to be resource, null given in C:\xampp\htdocs\IOD\loginToIOD.php on line 52
Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xampp\htdocs\IOD\loginToIOD.php on line 57
Here's the code in that area of the page:
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "WOTCPg1.php";
$MM_redirectLoginFailed = "loginerror.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_LogIn, $LogIn);
$LoginRS__query=sprintf("SELECT UserID, Password FROM authentication WHERE UserID=%s AND Password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $LogIn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
The mysql database is named "InfoOnDemand". It currently contains only 1 table, named "Authenticate", with just one record. The table fields are:
UserID CHAR 30; Password CHAR 20; CustID CHAR 20 and Status CHAR 10 Default value "in" (that should be "out", but I haven't changed it yet).
