2 Replies Latest reply on Aug 15, 2007 8:03 AM by johngordon12

    Log In behaviour

    johngordon12 Level 1
      Not sure if this is readily do-able with a little code perhaps.

      DW's (MX 2004) log in behaviour is pretty good - but what I'd quite like is if in my navbar, I could have a Log In link if a user isn't logged in, and a Log Out link if a user is logged in.

      Or I could have a link to an 'Admin Menu', and something controlling whether or not the Log Out link appeared?

      Any help much appreciated - I'm sure it's probably do-able with a little code, but I would be guessing with the syntax.

        • 1. Re: Log In behaviour
          bregent Most Valuable Participant
          Sure. Just write a condition that checks the logged in status and display one message or the other.
          • 2. Re: Log In behaviour
            johngordon12 Level 1
            That's what I'm trying. At the moment I've applied DW's log out behaviour, with the code :

            <div id="navcontainer" align="center">
            <ul id="navlist">
            <li><a href="index.php">Home</a></li>
            ..
            <li><a href="<?php echo $logoutAction ?>">Log Out</a></li>
            </ul>
            </div>

            So I've been trying things like :

            <li>
            <?php
            if(isset($_SESSION['username'])) {
            echo "Logout";
            } else {
            echo '<a href="login.php">Log In</a>';
            }
            ?>
            </li>

            But obviously going wrong somwhere.