This involves editing the Log In User server behavior code generated by Dreamweaver, so it will no longer be editable through the server behavior dialog box. However, making the changes are quite simple.
The final section of the code created by Dreamweaver looks like this:
//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 );
}
}
You need to use $loginStrGroup to determine the name of the page that you are redirecting people to. Do this with a switch() statement.
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
// set the destination page depending on access level
switch($loginStrGroup) {
case 'accesLevel1':
$MM_redirectLoginSuccess = 'level1.php';
break;
case 'accessLevel2':
$MM_redirectLoginSuccess = 'level2.php';
break;
// create similar case statements for the remaining six levels
}
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}