Forum Moderators: coopster
Even pointers as to what functions I need to perform would help... HELP!
<?php
session_start();
$url = getenv('HTTP_REFERER');
if ($url == "") { $url="http://www.myurl.com/";
session_register('url');
}
// *** Validate request to log in to this site.
$loginFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($accesscheck)) {
$accesscheck = $GLOBALS['PrevUrl'];
session_register('PrevUrl');
}
if (isset($HTTP_POST_VARS['UserEmail'])) {
$loginUsername=$HTTP_POST_VARS['UserEmail'];
$password=$HTTP_POST_VARS['UserPassword'];
$MM_fldUserAuthorization = "UserLevel";
$MM_redirectLoginSuccess = "userloginsuccess.php";
$MM_redirectLoginFailed = "userlogin.php?badlogin=true";
$MM_redirecttoReferrer = true;
mysql_select_db($database_visioneng, $visioneng);
$LoginRS__query=sprintf("SELECT UserEmail, UserPassword, UserLevel FROM usersweb WHERE UserEmail='%s' AND UserPassword='%s'",
get_magic_quotes_gpc()? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc()? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $visioneng) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'UserLevel');
//declare two session variables and assign them
$GLOBALS['MM_Username'] = $loginUsername;
$GLOBALS['MM_UserGroup'] = $loginStrGroup;
//register the session variables
session_register("MM_Username");
session_register("MM_UserGroup");
if (isset($HTTP_SESSION_VARS['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $HTTP_SESSION_VARS['PrevUrl'];
}
header("Location: ". $MM_redirectLoginSuccess . "?url=$url" );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>