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

php access level from login

New Here ,
Jul 23, 2009 Jul 23, 2009

using php to build a login. i have 14 different pages. I want 14 users with their own un/pw to see his/her own page. in my db i setup users name pw access level. i also in dw use the restrict page bassed on access level. however where do i set who goes to which page? example. Im a football player,  i log in under football and get the football page. if i log in under baseball i get the baseball page.

can you help?

TOPICS
Server side applications
3.3K
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
Advisor ,
Jul 23, 2009 Jul 23, 2009

Set access level by using a session variable. Look here for info on how to create a session variable. Then use an if statement to direct to access page based on session variable. By default DW creates a session variable MM_Username you can create a filtered recordset from this session variable to create additional session variables for other database table fields for logged in user.

Does that help?

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 ,
Jul 23, 2009 Jul 23, 2009

Ill try it. thanksl

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 ,
Jul 23, 2009 Jul 23, 2009

hmm

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 ,
Jul 23, 2009 Jul 23, 2009

What if I just did a simple php if statement based on access level. example if access leve = '' redirect to (url)?

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
Advisor ,
Jul 23, 2009 Jul 23, 2009

How do you determine the access level? Through a session variable.

You could try the other way and if that works for you that's great!

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 ,
Jul 23, 2009 Jul 23, 2009

I see.

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
Guest
Jul 23, 2009 Jul 23, 2009

If u want to redirect users based on their access level, do this

$_SESSION['MM_UserGroup'] = $loginStrGroup;

if ($loginStrGroup == "football_player") {

    header("Location: football.php");
}

.. do the rest for the other type of access level

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 ,
Jul 23, 2009 Jul 23, 2009

Thanks...ill try it tonight.

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 ,
Jul 25, 2009 Jul 25, 2009

Great. but i have new question:

How do i populate a text input field with a word based on user access level.

exp. if im user football_player and my access level is leader i want a text

input filed on form page to say Dallas.

Can you help me?

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
Guest
Jul 26, 2009 Jul 26, 2009

$_SESSION['MM_UserGroup'] = $acessLevel;

$_SESSION['MM_Username'] = $username;

Use this two sessions, filter by using if-then statement

Anyway, im not really understand what u need

>How do i populate a text input field with a word based on user access level.

I guess maybe u can try to use $_GET['$accessLevel']. Something like, when user login, then u can see textfield already stated with Dallas. Maybe u can try like below:

if($_GET['accessLevel'] == 'leader') {

$textfield = 'Dallas';

}

Then at the textfield, click at the text field, see at the properties. U can see from the value field, add this one <?php echo $textfield; ?>.

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 ,
Jul 27, 2009 Jul 27, 2009
LATEST

Sweet. Thanks.. Ill let you know how it turns out.

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 ,
Jul 25, 2009 Jul 25, 2009

Great. but i have new question:

How do i populate a text input field with a word based on user access level.

exp. if im user football_player and my access level is leader i want a text

input filed on form page to say Dallas.

Can you help me?

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
Advisor ,
Jul 25, 2009 Jul 25, 2009

Create session variable for everything you want filtered then use an if statement to show results from recordset.

if ($user == "football_player" && $access_level == "coach") {

   <?php echo $recordset_value['dynamic_text']; ?>
}

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 ,
Jul 25, 2009 Jul 25, 2009

can you supply a quick code example?

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
Advisor ,
Jul 25, 2009 Jul 25, 2009

*already supplied

use the example where session variables have been set for $user and $access_level and recordset_value is the name of your recordset and dynamic_text is the name of the table field in your database that you'd like displayed. Info on how to create session variables has been provided in my first response. All your requests involve setting session variables then using an if statement to show the dynamic info... see a pattern yet?

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