I have a catalogue page with three different navigation links depending on the session that is logged at the time. Issue I am having is no matter what I do, I can not get the loggedstaff navigation to show for when a staff member is logged on. I have even removed the logged navigation and it still did not work.
Code for the catalogue page is
[php]<?php
require_once “…/database/dbconn.php”;
require_once “…/includes/functions.php”;
$condb = connect();
if (!isset($_SESSION[‘loggedstaff’]) || !isset($_SESSION[‘logged’]));
{
session_start();
}
?>
catalogueBarzzar Ceramics
Contempary desings, old school service
</div>
</div>
<div id="menu">
<?php
if (!isset($_SESSION['logged']))
echo "
<ul>
<li class='active'><a href='../index.php' accesskey='1' title='Index'><span>Home</span></a></li>
<li><a href='login.php' accesskey='2' title=''><span>Login</span></a></li>
<li><a href='register.php' accesskey='3' title=''><span>register</span></a></li>
<li><a href='catalogue.php' accesskey='4' title=''><span>catalogue</span></a></li>
<li><a href='search.php' accesskey='4' title=''><span>search</span></a></li>
</ul>";
else if (isset($_SESSION['logged']))
echo "
<ul>
<li><a href='../index.php' accesskey='1' title='Index'><span>Home</span></a></li>
<li><a href='catalogue.php' accesskey='4' title=''><span>catalogue</span></a></li>
<li><a href='../shoppingcart/shopcart.php' accesskey='3' title=''><span>cart</span></a></li>
<li><a href='changepassword.php' accesskey='4' title=''><span>change password</span></a></li>
<li><a href='orderdetails.php' accesskey='4' title=''><span>View orders</span></a></li>
<li><a href='search.php' accesskey='4' title=''><span>search</span></a></li>
<li><a href='logout.php' accesskey='4' title=''><span>logout</span></a></li>
</ul>";
else if (isset($_SESSION['loggedstaff']))
echo "
<ul>
<li><a href='../admin/adminindex.php' accesskey='1' title='Index'><span>Home</span></a></li>
<li><a href='catalogue.php' accesskey='4' title=''><span>catalogue</span></a></li>
<li><a href='../admin/adminnewproduct.php' accesskey='3' title=''><span>new product</span></a></li>
<li><a href='../admin/changeproduct.php' accesskey='3' title=''><span>update product</span></a></li>
<li><a href='../admin/adminchangepassword.php' accesskey='4' title=''><span>change password</span></a></li>
<li><a href='logout.php' accesskey='4' title=''><span>logout</span></a></li>
</ul>"
?>
<!-- close of changed nav-->
<!-- not logged session nav working to this point -->
</ul>
</div>
<div id="page">
<div id="content">
<div class="post">
<div class="entry">
<p class="img-margin"> </p>
<?php
if(!empty($error_message))
{
echo ''. $error_message. '
'; } ?> <?php if (isset($_SESSION['logged'])) $customer_id = $_SESSION['UserID']; ?> <?php { $query = " SELECT * FROM tblproducts"; $result = mysqli_query($condb, $query) or die(mysqli_error()); while ($rows = mysqli_fetch_assoc($result)){ { ?><form method="post" action="../shoppingcart/processcart.php">
<table>
<tr>
<td>Product code</td>
<td><?php echo $rows['Product_code'];?></td>
</tr>
<tr>
<td>product name</td>
<td><?php echo $rows['Product_name'];?></td>
</tr>
<tr>
<td>Product description</td>
<td><?php echo $rows['Product_descroption'];?></td>
</tr>
<tr>
<td>Product size</td>
<td><?php echo $rows['Product_size'];?></td>
</tr>
<tr>
<td>Product price</td>
<td><?php echo $rows['Product_price'];?></td>
</tr>
<tr>
<td>product image</td>
<td><img src="<?php echo IMAGEFOLDER.$rows['product_image']?>" height="100px" width="100px" /></td>
</tr>
<input type="hidden" name="Product_code" value="<?php echo $rows['Product_code']; ?>" />
<input type="hidden" name="Product_price" value="<?php echo $rows['Product_price']; ?>" />
<input type="hidden" name="Product_name" value="<?php echo $rows['Product_name']; ?>" />
<?php if (isset($_SESSION['logged'])) echo"<td><input type='test' name='qtyordered' /></td>";?>
<?php if (isset($_SESSION['logged'])) echo "</table>
</form>
<?php
}
$_SESSION[‘cart’] = true;
if (isset($_SESSION[‘logged’]))
if (isset($_SESSION[‘cart’]))
{
echo ‘View Shopping cart’;
}
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
© admin login here
I thought also having the code for the admin index might help
[php]<?php
if (!isset($_SESSION[‘loggedstaff’]))
{
session_start();
}
?>
admin indexBarzzar Ceramics
Contempary desings, old school service
</div>
</div>
<div id="menu">
<?php
if (isset($_SESSION['loggedstaff']))
echo "
<ul>
<li><a href='adminindex.php' accesskey='1' title='Index'><span>Home</span></a></li>
<li><a href='../shop/catalogue.php' accesskey='4' title=''><span>catalogue</span></a></li>
<li><a href='adminnewproduct.php' accesskey='3' title=''><span>new product</span></a></li>
<li><a href='changeproduct.php' accesskey='3' title=''><span>update product</span></a></li>
<li><a href='adminchangepassword.php' accesskey='4' title=''><span>change password</span></a></li>
<li><a href='../shop/logout.php' accesskey='4' title=''><span>logout</span></a></li>
</ul>";
?>
<!-- close of changed nav-->
<!-- not logged session nav working to this point -->
</ul>
</div>
<div id="page">
<div id="content">
<div class="post">
<div class="entry">
<p class="img-margin"> </p>
</div>
</div>
</div>
</div>
</div>
</div>
© admin login here