Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/projects/slutprojekt/include/

footer.php
header.php
session-variables.php

header.php

40 lines UTF-8 Windows (CRLF)
<header>
  <nav class="navbar">
    <div class="logo"><a href="start.php" class="logo-link">Kokboken</a></div>
    <div id="menu-btn" onclick="menuDrop()"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"/></svg></div>
    
    <ul id="nav-links">
      <?php if($_SESSION['admin'] == true) { ?>
      <li><a href="create-recipe.php" class="current1">Skapa Recept</a></li>
      <li><a href="create-categories.php" class="current2">Skapa Katagori</a></li>
      <li><a href="db_content.php" class="current3" >Innehåll</a></li>
      <?php ?>
    </ul>
    

    <?php if($_SESSION['loggedin'] == true) { ?>
      <div id="login"><a href="logout.php">Logga ut</a></div>
    <?php ?>

    <?php if($_SESSION['loggedin'] != true) { ?>
      <div id="login"><a href="login.php">Logga in</a></div>
    <?php ?>

  </nav>
  <script>
    function menuDrop() {
      let x = document.getElementById("nav-links");
      let y = document.getElementById('login');
      if (x.style.display === "block") {
        x.style.display = "none"
        y.style.display = "none"
      }
      else {
        x.style.display = "block"
        y.style.display = "block"
      }


    }
  </script>
</header>