PDA

View Full Version : Conditional Regions


dlovas275157
10-20-2009, 05:25 PM
I am fairly new to WA. I have been working hard to recode old sites that were originally build using ADDT. Does WA offer any tools/server behaviors for creating Conditional Regions similar to the ones ADDT offered? I cannot seem to find any conditional tools in the SuperSuite I have subscribed to.

Particularly, I would like to add a conditional statement to my login.php page that would only show the message "account has been activated" if the referring url is my activate.php page.

Can this conditional be accomplished within WA, or will I need to handcode it? If I need to handcode, can anyone help point me in the right direction as my handcoding is not the sharpest.

Thanks.

Eric Mittman
10-21-2009, 12:54 PM
There are conditional regions that can be applied with Security Assist but you would need a rule that checks the referring page. To add a new rule go to Modify > Security Assist > Access Rules Manager. Add a new rule and give it a name set it to allow and for the value use this:


<?php echo((isset($_SERVER["HTTP_REFERER"]))?strpos(urldecode($_SERVER["HTTP_REFERER"]), "activate.php"):"") ?>


This is checking to see if the referer variable is set and if it is it does a strpos check on this value looking for "active.php".

Once you have this entered for the value choose ">" and enter 0 for the value. This should check the referer to ensure it contains active.php. If it does then the rule will allow access.

Once you have the rule crafted you just need to highlight the message on the page and go to Server Behaviors > Security Assist > Show Region and select this new rule.