close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Restrict access to page

Thread began 9/06/2017 7:51 am by Nikou | Last modified 9/11/2017 9:42 am by Ray Borduin | 1560 views | 5 replies |

Nikou

Restrict access to page

Hi;
I'd like to have a restricted access to page based on username, password and access level, the same as built-in dreamweaver server behaviors, but the webassist server behaviors seems differs from that. How can I determine the access level?

Sign in to reply to this post

Ray BorduinWebAssist

You could store the access level in the session when you log in and then check the access level from that session variable on the individual pages.

Another solution would be to have multiple authentication server behaviors on the login page and have separate logins for each access level (only one form, but multiple server behaviors). I'd probably go with this option if you only have a couple of access groups.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nikou

Is there anybody to help me to revise the code provided by "MySQLi Log In User" not redirect to a single page but to different pages based on users access level e.g. admin= level 1, manager= level 2 and user=level 3.
Admins can access to all pages but managers / users are restricted to their own pages.

Sign in to reply to this post

Ray BorduinWebAssist

You can save the user access level in the session and then use a simple IF statement on the login page to redirect. Remove the success redirect from the "MySQLi Log In User" server behavior entirely and then use the same trigger below to redirect based on the value of the saved session variable instead.

Sign in to reply to this post
Did this help? Tips are appreciated...

Nikou

This post has been deleted.

Nikou

Thanks Ray, Finally I managed the code as I wanted a little bit different from your guidance. I did not change the "MySQLi Log In User" at all. Instead I changed the successful redirected page with IF statements as follows:

<?php

//Direct pages with different user levels
if ($_SESSION['accesslvl'] == '1') {
header('location: user1.html'); //User1
session_register("username");
session_register("password");

}
else
if ($_SESSION['accesslvl'] == '2') {
header('location: user2.html'); //User2
session_register("username");
session_register("password");

}
else
if ($_SESSION['accesslvl'] == '3') {
header('location: user3.html'); //user 3
session_register("username");
session_register("password");

}
else
{
// Error login
echo "<script>alert('Access Denied!');
window.location='access_denied.php';
</script>";
}

?>

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...