close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Restrict Page to Admin Only

Thread began 12/14/2009 10:32 am by Douglas Fox | Last modified 12/15/2009 5:18 am by Douglas Fox | 1526 views | 3 replies |

Douglas Fox

Restrict Page to Admin Only

Hi All:

I'm sure this is super simple, but I'm struggling nonetheless.

I'm trying to restrict a page to administrators only. I've created a column in my database called 'UserLevel' and have assigned appropriate levels to each user. I've assigned user level = 2 to be the admin user, and I want to restrict a page only to those users logged with that level of clearance.

I've created a session variable called 'UserLevel' and have tested it by placing in dynamic text on a page, it seems to be working just fine.

I've create a rule called "Logged in as admin" and set the following conditions (taken from the Securite Assist generated php file):

case "Logged in to admin":
$comparisons[0] = array(TRUE, "".((isset($_SESSION['visitorID']))?$_SESSION['visitorID']:"") ."", 2, "");
$comparisons[1] = array(TRUE, "".((isset($_SESSION['UserLevel']))?$_SESSION['UserLevel']:"") ."", 1, "2");
break;

However, when I test this all out, it still lets anyone who is logged in to view the page. What am I doing wrong???

Thanks for your help in advance.

Sign in to reply to this post

Douglas Fox

Restric Access to Admin, Solved! But Why?

Hi All:

I solved my earlier problem by taking out the first condition, so now the users cannot view the specified page unless their user access level is equal to 2.

However, I'm a bit puzzled. The first condiiton was that the session variable containing their visitor ID must not be null. Shouldn't the 2 conditions put together work???

Just so I understand why it worked, could anyone help explain?

Thanks,

Doug

Sign in to reply to this post

Jason ByrnesWebAssist

When you have multiple conditions on the page, only one of them needs to evaluate to true for the rule to pass. Once a condition evaluates to true, the rule passes and the other conditions are not checked.

Sign in to reply to this post

Douglas Fox

multiple conditions

I didn't realize that, I thought they all had to pass in order to validate the user. Thanks for the clarification.

Doug

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...