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

Modifying if statement

Thread began 1/14/2016 9:52 pm by Jason | Last modified 1/16/2016 4:34 pm by Ray Borduin | 102 views | 2 replies |

Jason

Modifying if statement

Does doing something like this create any security issues? It works for what I'm trying to do (allows a user access to their own record and their families records if they are a parent), but I didn't know if there were any risk to adding extra statements to the default rules manager "if" statement.

php:
<?php

if((((isset($_GET['person_id'])) && ($_SESSION['userlogin_id']) !== (($_GET['person_id']))) && (($user_household_id->getColumnVal("household_position") <= 2) && (($user_household_id->getColumnVal("household")) !== ($household_id->getColumnVal("household"))))) && (!WA_Auth_RulePasses("People Directory Manager"))) {
    
WA_Auth_RestrictAccess("../../../login.php");
}
?>
Sign in to reply to this post

Ray BorduinWebAssist

This looks wrong to me.... I think you would want to use or: '||' and not and:'&&'

Because if any one of those conditions fail you would want it to redirect. The statement you have would only redirect to the login page if

person_id is in the url AND the session_id matches the person_id
AND
the household_position value of the user is less than or equal to two
AND
the household values match in the two recordsets
AND
the user is not logged in
THEN
take them to the login page

I think it should probably be something like:

php:
<?php

if( !isset($_GET['person_id']) || ($_SESSION['userlogin_id'] !== $_GET['person_id'] && $user_household_id->getColumnVal("household_position") <= 2) || $user_household_id->getColumnVal("household") !== $household_id->getColumnVal("household")) || !WA_Auth_RulePasses("People Directory Manager")) {
    
WA_Auth_RestrictAccess("../../../login.php");
}
?>



Which reads:
if there is no person_id in the url
OR
if the session variable user doesn't match the user AND the household position is less than or equal to 2
OR
if the household values don't match
OR
if they aren't logged in
THEN
take them to the login page

Sign in to reply to this post

Jason

I see what you mean. Thanks Ray!

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