I am very much new the PHP world and have what I believe to be a simple question..
I am using one of the Dreamweaver User Auth scripts with a mySQL database. I have the verification process down, but I would like to redirect each user to a different directory/page.
In the mySQL I have the data for where I would like to redirect each user, but I can't get it to translate properly.
Basically, I want a user to be able to login from a central page and be taken to their site/page automatically...
Here's the code.... The line in bold is where I believe I am doing something wrong. Please let me know if you have anythoughts!! Thanks!!
Thanks in advance for any advice!
<?php require_once('../Connections/database.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['user'])) {
$loginUsername=$_POST['user'];
$password=$_POST['pass'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "/" & $_POST['redirect'] & "/index.html";
$MM_redirectLoginFailed = "http://clients.mysite.com";
$MM_redirecttoReferrer = false;
mysql_select_db($database_lp_database, $lp_database);
$LoginRS__query=sprintf("SELECT user, pass FROM authentication WHERE user='%s' AND pass='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $lp_database) 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 );
}
}
?>