greetings -
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!!
<?php require_once('. ./Connections/database.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSI ON)) {
session_start() ;
}
$loginFormActio n = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['user'])) {
$loginUsername= $_POST['user'];
$password=$_POS T['pass'];
$MM_fldUserAuth orization = "";
$MM_redirectLog inSuccess = "/" & $_POST['redirect'] & "/index.html";
$MM_redirectLog inFailed = "http://clients.mysite. com";
$MM_redirecttoR eferrer = false;
mysql_select_db ($database_lp_d atabase, $lp_database);
$LoginRS__query =sprintf("SELEC T user, pass FROM authentication WHERE user='%s' AND pass='%s'",
get_magic_quote s_gpc() ? $loginUsername : addslashes($log inUsername), get_magic_quote s_gpc() ? $password : addslashes($pas sword));
$LoginRS = mysql_query($Lo ginRS__query, $lp_database) or die(mysql_error ());
$loginFoundUser = mysql_num_rows( $LoginRS);
if ($loginFoundUse r) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSIO N['PrevUrl']) && false) {
$MM_redirectLog inSuccess = $_SESSION['PrevUrl'];
}
header("Locatio n: " . $MM_redirectLog inSuccess );
}
else {
header("Locatio n: ". $MM_redirectLog inFailed );
}
}
?>
Thanks in advance for any advice!
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!!
<?php require_once('. ./Connections/database.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSI ON)) {
session_start() ;
}
$loginFormActio n = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['user'])) {
$loginUsername= $_POST['user'];
$password=$_POS T['pass'];
$MM_fldUserAuth orization = "";
$MM_redirectLog inSuccess = "/" & $_POST['redirect'] & "/index.html";
$MM_redirectLog inFailed = "http://clients.mysite. com";
$MM_redirecttoR eferrer = false;
mysql_select_db ($database_lp_d atabase, $lp_database);
$LoginRS__query =sprintf("SELEC T user, pass FROM authentication WHERE user='%s' AND pass='%s'",
get_magic_quote s_gpc() ? $loginUsername : addslashes($log inUsername), get_magic_quote s_gpc() ? $password : addslashes($pas sword));
$LoginRS = mysql_query($Lo ginRS__query, $lp_database) or die(mysql_error ());
$loginFoundUser = mysql_num_rows( $LoginRS);
if ($loginFoundUse r) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSIO N['PrevUrl']) && false) {
$MM_redirectLog inSuccess = $_SESSION['PrevUrl'];
}
header("Locatio n: " . $MM_redirectLog inSuccess );
}
else {
header("Locatio n: ". $MM_redirectLog inFailed );
}
}
?>
Thanks in advance for any advice!
Comment