Hi, I am having massive trouble with my login page.
I have ceated it in DWMX and DW8 and neither work.
I have created a document login2.php and it passes the MM_Username created by DW well.
As soon as I try and add anything to the page or try to copy the script directly into a template it doesn't pass on the session variable.
I have posted the entire script below, can someone please see if they can spot the reason why it wont work for me.
Anothr bug is it works fine on the localhost, which is even more annoying.
This is the login page that works login2.php
<?php require_once('Connections/tbbdb.php'); ?>
<?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 = "index.php";
$MM_redirectLoginFailed = "login_bad.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_tbbdb, $tbbdb);
$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $tbbdb) 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 );
}
}
?>
<form name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
Username:
<input name="username" type="text" id="username">
Password:
<input name="password" type="text" id="password">
<input type="submit" name="Submit" value="Submit">
</form>
I wont submit the entire code for the login page that doesn't work unless anybosy asks for it but can anybosy see why t wouldn't work from this script.
and can someone please tell me how I get the code colour coded in the posts as that is the main reason I have not posted the full page that doesn't work.
Thanks in advance.
John