Skip to content

Commit

Permalink
prevent user from accessing cart unless logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
atishdhu committed Dec 26, 2020
1 parent c1aa479 commit 8ff7a6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Includes/PcNavBar.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php include "./AdditionalPHP/checkAccess.php"; ?>
<?php include "numOfItemsInCart.php";?>

<?php

Expand All @@ -10,8 +11,10 @@
if(isset($_SESSION['uname'])){
$href = 'checkAccount.php';
$icon = 'bx bxs-user-circle';
$cartHref = 'cart.php';
} else {
$href = 'login.php';
$cartHref = 'login.php';
$icon = 'bx bx-user-circle';
}
?>
Expand All @@ -27,7 +30,7 @@
<li><a href="makeyourcake.php" class="<?php if($page == 'makeyourcake'){echo 'active';}?>">MAKE YOUR CAKE</a></li>
<li><a href="about.php" class="<?php if($page == 'about'){echo 'active';}?>">ABOUT</a></li>
<li><a href="contact.php" class="<?php if($page == 'contact'){echo 'active';}?>">CONTACT US</a></li>
<li><a href="cart.php" class="<?php if($page == 'cart'){echo 'active';}?>"><i class="bx bx-cart nav__cart"></i></a>
<li><a href="<?php echo $cartHref;?>" class="<?php if($page == 'cart'){echo 'active';}?>"><i class="bx bx-cart nav__cart"></i></a>
<p class="cart-number"><?php echo $_SESSION['item_quantity']; ?></p></li>
<li><a href="<?php echo $href;?>" class="<?php if($page == 'login' || $page == 'checkaccount'){echo 'active';}?> user-button"><i class="<?php echo $icon;?>"></i></a></li>
</ul>
Expand Down

0 comments on commit 8ff7a6c

Please sign in to comment.