Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Ill try it. thanksl
Copy link to clipboard
Copied
hmm
Copy link to clipboard
Copied
What if I just did a simple php if statement based on access level. example if access leve = '' redirect to (url)?
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
I see.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks...ill try it tonight.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
$_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; ?>.
Copy link to clipboard
Copied
Sweet. Thanks.. Ill let you know how it turns out.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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']; ?>
}
Copy link to clipboard
Copied
can you supply a quick code example? ![]()
Copy link to clipboard
Copied
*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?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now