Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    39
    Plugin Contributions
    0

    Default Determine Login?

    I'm using a different style for my top header.. I have a button that says "Login" and takes the client to index.php?main_page=login. How can I use an If statement so that if they are logged in it will write a different a href and img tag that will link to main_page=logout and the image logout.jpg, else it will show the default with login and taking them to login.. I know how to do it with If/Else but I don't know what to use to determine if they are logged in or not..

    Thanks in advance!

  2. #2
    Join Date
    Apr 2006
    Posts
    265
    Plugin Contributions
    0

    Default Re: Determine Login?

    Take a look at the existing code in the default header file (includes/templates/template_default/common/tpl_header.php)

    The code to do what you want is already there:
    PHP Code:
    <?php if ($_SESSION['customer_id']) { ?>
        <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF'''SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF?></a></li>
        <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT'''SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT?></a></li>
    <?php
          
    } else {
            if (
    STORE_STATUS == '0') {
    ?>
        <li><a href="<?php echo zen_href_link(FILENAME_LOGIN'''SSL'); ?>"><?php echo HEADER_TITLE_LOGIN?></a></li>
    <?php } } ?>
    BrandTim

  3. #3
    Join Date
    Aug 2007
    Posts
    39
    Plugin Contributions
    0

    Default Re: Determine Login?

    Thanks! You rawk :)

 

 

Similar Threads

  1. Determine if product is in a certain catagory
    By JoshS in forum General Questions
    Replies: 2
    Last Post: 15 Sep 2015, 05:38 PM
  2. v151 Determine weight of an existing order
    By lat9 in forum Managing Customers and Orders
    Replies: 6
    Last Post: 6 May 2013, 09:47 PM
  3. Can I determine login status from JavaScript?
    By lightnb in forum Code Collaboration
    Replies: 3
    Last Post: 24 Feb 2013, 04:43 PM
  4. How to determine $box_id
    By thomasw98 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 17 Aug 2007, 11:20 PM
  5. Determine if user is logged in
    By artcoder in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 6 May 2007, 02:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR