close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Trouble with 'if' when someone is logged in

Thread began 11/12/2009 11:38 am by steven348539 | Last modified 11/12/2009 5:19 pm by steven348539 | 1309 views | 2 replies |

steven348539

Trouble with 'if' when someone is logged in

I am trying to setup a conditional that would show either a menu or links depending on if someone is logged in and what their user level is. The following code was working well with the links until I tried to add the admin links.

php:
<?php if ($_SESSION['UserLevel'] >= '1') {

        echo 
"<h3><a href=/visitors_profile.php>Update Account</a></h3>" ;
        echo 
"<h3><a href=/visitors_LogOut.php>Logout</a></h3>" ;
      } else{
        echo 
"<h3><a href=/visitors_LogIn.php>Login</a></h3>" ;
      }
        
?>



I was wanting anyone who had a user level of 1 or greater to see the logout and Update links.

I removed the admin links but it still wouldn't work and until I deleted the pages the Security Wizard made (login, logout, etc) and re-created them, the system wouldn't allow anyone to log in. You could enter correct or incorrect data and the login page would come up, not direct you to the failed page.

So, to test things, I added this code

php:
<?php if (!isset($_SESSION['VisitorID'])) { echo "Session['VisitorID'] == NULL" ; } ?>



On pages that deal with the shopping cart, the line doesn't show up, on pages that are information about the business, it does show up, even though the person is logged in. However, on all pages, the login link is shown even if someone is already logged in.

The Session variable is available in all the pages within Dreamweaver.

if you would like to see, website is www.cis-portraits.com Print Store is the shopping cart, other pages is information.

You can log in with

username: test@test.com
password: blah

Only allows someone to order and view their proofs if they have any. No admin functions under that login.

Sign in to reply to this post

Dani Chankhour

In Security Assist there is a Show Region Server Behavior that is located under the Server Behaviors panel (Window -> Server Behaviors). All you have to do is select the region and then apply the Server Behavior which only shows certain regions on your page based on a Security Assist Rule, and since you have used Security Assist to generate the login and registration page, login rules should have been already created for you.

You could look at more documentation at:

securityassist/


This should give you more flexibility instead of hand coding the check using the session.


let me know if you still have any other questions.

Sign in to reply to this post

steven348539

Thank you. Guess that's what I get for originally programing on store front almost 15 years ago in C and perl. I start seeing what should work, but it doesn't mean it is the easiest way to do things.

So not used to programming everything myself. Now, if my other question in the ecart forum gets answered, maybe I can finish this yet...

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