close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Validating User Age with Redirect and set lockout Session Variable

Thread began 9/21/2009 5:32 pm by Kevin373660 | Last modified 9/23/2009 6:18 pm by Jason Byrnes | 3319 views | 8 replies |

Kevin373660

Validating User Age with Redirect and set lockout Session Variable

In a parent registraion php page using Validation Toolkit, I have a form with user input fields validated and a dop down menu/list with ages. I need to Validate a User Age and if a user is below a certain age, Redirect them to a page that says "sorry please ask your parents to set up your account" and set lockout Session Variable.

Would it be possible to set the Server Behavior Validation to redirect if the value for that one input/drop down is = say 0? And have a second Server Behavior on the same page and same form for the remainder of the input values?

Or is it better to have three pages: 1st with age, a 2nd with parent form and a 3rd saying your too young and sets a session lockout variable some how?

What is the best approach for a Rookie to set up?

Sign in to reply to this post

Kevin373660

Ok, I did was able to acomplish the first step.

From one form (same page) I added a second WA Server Validation behavior using the Validation Type: Restrict Content and added a Failed Redirect to the 'too young' page.

Now I need to how to handle the lock out with a session variable.

Sign in to reply to this post

Jason ByrnesWebAssist

On the to young page, create a session variable:
use the Cookies toolkit Set Session Value Server behavior. On the Server behaviors panel, Click the Plus Button and select WA Cookies -> Set Session value.

Use the Before Page Load trigger, set the name to "lockout" and the value to "yes"

Then using the SecurityAssist access rules manager, Create a new rule. Go to Modify -> SecurityAssist -> Access Rules manager.
Set the Restrict option. Click the Lightning bolt next to value and select the lockout session variable. Select Equals for the comparison and type "yes" in the compare to box.


open the page you wish to restrict access to and Click the Plus button on the server behaviors panel, Select SecurityAssist -> Page Access. from the list select the rule you just created and select a page to redirect to.

Sign in to reply to this post

Kevin373660

Thank you, Jason. Your detailed instructions were very easy to follow.

However, I seem to have gone amiss somewhere. When I land on the parents_Registration.php, I am automatically redirected to the registration.php (with the “Please ask you parents to sign up your membership.”

The message in the url seems to indicate that it is checking the HelperGroupsRulesPHP file ok. But, I am not sure how it knows that the session is locked out since that variable should not be picked up until you hit the registration.php page. I have tried clearing the browser cash, closing and opening it again while testing. Where did I go wrong?

****************************************************
parents_Registration.php

<?php
if (!session_id()) session_start();
if("" == "") {
$_SESSION["userMinAge"] = "yes";
}
?>
*******************************************************

Registration.php

<?php require_once("../../WA_SecurityAssist/Helper_PHP.php" );
if (!WA_Auth_RulePasses("MinAgeLockout")){
WA_Auth_RestrictAccess("Registration.php");
}
?>
********************************************************
IN URL
Registration.php?accesscheck=%2Fpages%2Fmenu%2Fparents_Registration.php

Sign in to reply to this post

Jason ByrnesWebAssist

looks like you added the MinAgeLockout page restriction to parents registration page as well.

Sign in to reply to this post

Kevin373660

Help, I am totally lost and have become very good at locking out the wrong pages. I have reread the docs and watched the online video twice. I have even tried reversing the code blocks between the two pages. Perhaps I am just not geting the logic of the process?

I want all visitors to be able to get to the parents_Registration.php, and only be locked out and redirected to the Registration.php, only if they are too young.

Sign in to reply to this post

Jason ByrnesWebAssist

Please send your pages in a zip file so I can examine the coded.

Sign in to reply to this post

Kevin373660

Thanks Jason. Please find attached a zip with both files. Setting up the Access manager for the whole site is my next step before eCart. So getting a handle on this will hopefuly be a big help.

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so I can look into this with you a bit more.

To view and edit your support ticket, please log into your support history:
supporthistory.php

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