Hello everyone!
I have this login script that works perfectly on my local testing server but it will not work on my live server.
[code=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[‘customer_email’])) {
$loginUsername=$_POST[‘customer_email’];
$password=$_POST[‘customer_password’];
$MM_fldUserAuthorization = “customer_userGroup”;
$MM_redirectLoginSuccess = “image_uploader.php”;
$MM_redirectLoginFailed = “login_failed.php”;
$MM_redirecttoReferrer = true;
mysql_select_db($database_online_photos, $online_photos);
$LoginRS__query=sprintf(“SELECT customer_email, customer_password, customer_userGroup FROM customers WHERE customer_email=’%s’ AND customer_password=’%s'”,
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $online_photos) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,’customer_userGroup’);
//declare two session variables and assign them
$_SESSION[‘MM_Username’] = $loginUsername;
$_SESSION[‘MM_UserGroup’] = $loginStrGroup;
if (isset($_SESSION[‘PrevUrl’]) && true) {
$MM_redirectLoginSuccess = $_SESSION[‘PrevUrl’];
}
header(“Location: ” . $MM_redirectLoginSuccess );
}
else {
header(“Location: “. $MM_redirectLoginFailed );
}
}
?>
When login is successful the user should be directed from /login.php to /image_uploader.php. But on the live server, the URL gets changed to
/login.php?accesscheck=%2Fimage_uploader.php and the user just gets sent back to login.php!
print_r($_SESSION) returns nothing on my local testing server but on the live server it returns:
[MM_Username] => [email][email protected]
[MM_UserGroup] => vistor
[PrevUrl] => /image_uploader.php
Many Thanks!!! This has been driving me crazy since Wed night!
Chris