heres the login .php code...
<?php require_once('Connections/login.php'); ?>
<?php
if (!function_exists("GetSQLValueString"
) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string"
? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != ""
? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != ""
? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != ""
? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != ""
? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != ""
? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?><?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 filed'])) {
$loginUsername=$_POST['username filed'];
$password=$_POST['password field'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "good.html";
$MM_redirectLoginFailed = "bad.html";
$MM_redirecttoReferrer = false;
mysql_select_db($database_login, $login);
$LoginRS__query =sprintf("SELECT username, password FROM users WHERE username=%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 );
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[
www.w3.org];
<html xmlns="[
www.w3.org];
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<table width="200" border="0">
<tr>
<td height="32">Username:</td>
<td> </td>
<td> </td>
<td> </td>
<td><label>
<input type="text" name="username filed" id="username filed" />
</label></td>
</tr>
<tr>
<td>Password:</td>
<td> </td>
<td> </td>
<td> </td>
<td><label>
<input type="password" name="password field" id="password field" />
</label></td>
</tr>
<tr>
<td height="33"> </td>
<td> </td>
<td> </td>
<td> </td>
<td><label>
<input type="submit" name="Login Button" id="Login Button" value="Login" />
</label></td>
</tr>
</table>
</form>
</body>
</html>