Copy link to clipboard
Copied
Hi
I am using Dreamweaver CS4 and have created many login pages using the server behaviour without a problem. What I now need to do is create one login page and depending on 8 different access levels point the user to one of 8 different pages. The access levels are all setup but is there any way to direct a user to a specific page depending on their access level? I can do it using the previous url method but wondered if there is any way to echo out the access level variable (the page name eg levelone.php) in the success url within the login form?
Any help appreciated.
Thanks Nikki
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_redirectLoginSuc
Copy link to clipboard
Copied
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 );
}
}
Copy link to clipboard
Copied
Thanks David.
I thought there must be a simple answer to this.
Just tested it and it works a treat.
Thanks again
Nikki
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more