Hello, I am learning more PHP & MySQL everyday, but...
Does anyone know how to edit the "log in user" behaviour for PHP/MX2004 so that i can have different level users directed to different start-pages.
I have read the page "User authentication - logging in to different pages"
( http://www.macromedia.com/support/ultradev/ts/documents/login_otherpages.htm )
But it doesn't cover PHP, and the PHP help pages/forums i've found only cover old versions of this Behaviour.
Any tips would be much appreciated.
Here's the code----------------------------------------
<?php
session_start();
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
$GLOBALS['PrevUrl'] = $accesscheck;
session_register('PrevUrl');
}
if (isset($POST['username'])) {
$loginUsername=$POST['username'];
$password=$_POST['userword'];
$MM_fldUserAuthorization = "userlevel";
$MM_redirectLoginSuccess = "client.php";
$MM_redirectLoginFailed = "loginfail.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_ConDB, $ConD😎;
$LoginRS__query=sprintf("SELECT username, username, userlevel FROM tbsecurity WHERE username='%s' AND username='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $ConD😎 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($SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}