Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

User Authentication

New Here ,
Apr 23, 2009 Apr 23, 2009

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

TOPICS
Server side applications
507
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 23, 2009 Apr 23, 2009

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

...
Translate
LEGEND ,
Apr 23, 2009 Apr 23, 2009

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 );
  }
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 23, 2009 Apr 23, 2009
LATEST

Thanks David.

I thought there must be a simple answer to this.

Just tested it and it works a treat.

Thanks again

Nikki

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines