View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Trouble with 'if' when someone is logged in

Thread began 11/12/2009 2:38 pm by steven348539 | Last modified 11/12/2009 8:19 pm by steven348539 | 931 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.

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