title: Dynamically change Login/Logout button based on status
body: <p>I want the navbar to either display "Admin" and "Logout" if the user is logged in, or "Log In" and "Register" if no user is logged in.  </p>
  
  <p>So far it's always showing Login and Register. It does keep the login, because I can't visit the login/register pages (I've made it so a logged in user gets redirected to home).</p>
  
  <p>My REGISTER id is just text styling.</p>
  
  <p>Login snippet:</p>
  
  <pre><code>if(isset($_POST["login"])){
  $username = trim($_POST['username']);
  $username = strip_tags($username);
  $username = htmlspecialchars($username);
  
  $password = trim($_POST['password']);
  $password = strip_tags($password);
  $password = htmlspecialchars($password);
  
  
  $loginQuery= "SELECT * FROM members where username='$username' AND password=PASSWORD('$password')";
  $result= mysqli_query($conn, $loginQuery);
  if(mysqli_num_rows($result)){
      $_SESSION['username'] = $username;
      header("Location: index.php");
  }
  else{
      $loginErrorExists= TRUE;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Homepage snippet:</p>
  
  <pre><code>&lt;?php
          if(isset($_SESSION['username'])){
              echo "&lt;a id=\"register\" class=\"header-button\" href=\"admin.php\"&gt;&lt;span class=\"bold small-white-subtitle\"&gt;Dashboard&lt;/span&gt;&lt;/a&gt;";
              echo "&lt;a id=\"register\" class=\"header-button\" href=\"logout.php\"&gt;&lt;span class=\"bold small-white-subtitle\"&gt;Logout&lt;/span&gt;&lt;/a&gt;";
          }
          else{
              echo "&lt;a id=\"register\" class=\"header-button\" href=\"login.php\"&gt;&lt;span class=\"bold small-white-subtitle\"&gt;Log In&lt;/span&gt;&lt;/a&gt;";
              echo "&lt;a id=\"register\" class=\"header-button\" href=\"register.php\"&gt;&lt;span class=\"bold small-white-subtitle\"&gt;Register&lt;/span&gt;&lt;/a&gt;";
          }
          ?&gt;
  </code></pre>