Jump to content

Basic PHP help needed :)


sequencehost

Recommended Posts

Hello,

 

I'm using the following code to display the top bar (logged-in navigation) on non-WHMCS pages. It works really well but I'm struggling to add the else statement to show content when not logged in.

 

If someone could help with this I'd be greatly appreciative:

 

 



<?php require("/home/username/public_html/folder/dbconnect.php");

if ($_SESSION['uid']) {

$query="SELECT * FROM tblclients WHERE id='" .sanitize($_SESSION['uid']). "'";

$result = mysql_query($query) or die(mysql_error());
if($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

  $clientsdetails['firstname']=$row['firstname'];
  $clientsdetails['lastname']=$row['lastname'];
  $clientsdetails['email']=$row['email'];

}

echo '


<div class="topbar">

<div class="fill">

<ul>
<li><a href="/clients/clientarea.php">Home</a></li>
</ul>

<ul>
<li class="menu">
<a href="#" class="menu">Services</a>
<ul class="menu-dropdown">
<li><a href="/clients/clientarea.php?action=products">My Services</a></li>
<li class="divider"></li>
<li><a href="/clients/cart.php">Order New Services</a></li>
<li><a href="/clients/cart.php?gid=addons">View Available Addons</a></li>
</ul>
</li>
</ul>

<ul>
<li class="menu">
<a href="#" class="menu">Domains</a>
<ul class="menu-dropdown">
<li><a href="/clients/clientarea.php?action=domains">My Domains</a></li>
<li class="divider"></li>
<li><a href="/clients/cart.php?gid=renewals">Renew Domains</a></li>
<li><a href="/clients/cart.php?a=add&domain=register">Register a New Domain</a></li>
<li><a href="/clients/cart.php?a=add&domain=transfer">Transfer Domains to Us</a></li>
<li class="divider"></li>
<li><a href="/clients/domainchecker.php">Whois Lookup</a></li>
</ul>
</li>

</ul>

<ul>
<li class="menu">
<a href="#" class="menu">Billing</a>
<ul class="menu-dropdown">
<li><a href="/clients/clientarea.php?action=invoices">My Invoices</a></li>
<li><a href="/clients/clientarea.php?action=quotes">My Quotes</a></li>
</ul>
</li>
</ul>

<ul>
<li class="menu">
<a href="#" class="menu">Support</a>
<ul class="menu-dropdown">
<li><a href="/clients/supporttickets.php">Tickets</a></li>
<li><a href="http://www.zomex.com/lab">Knowledgebase</a></li>
<li><a href="/clients/downloads.php">Downloads</a></li>
<li><a href="/clients/serverstatus.php">Network Status</a></li>
</ul>
</li>
</ul>

<ul>
<li><a href="/clients/submitticket.php">Open Ticket</a></li>
</ul>

<ul>
<li><a href="/clients/affiliates.php">Affiliates</a></li>
</ul>

<ul class="nav secondary-nav">

<li class="menu">
<a href="#" class="menu">Hello, '.($row['firstname']).'!</a>
<ul class="menu-dropdown">
<li><a href="/clients/clientarea.php?action=details">Edit Account Details</a></li>
<li><a href="/clients/clientarea.php?action=contacts">Contacts/Sub-Accounts</a></li>
<li><a href="/clients/clientarea.php?action=addfunds">Add Funds</a></li>
<li><a href="/clients/clientarea.php?action=emails">Emails Sent</a></li>
<li><a href="/clients/clientarea.php?action=changepw">Change Password</a></li>
<li class="divider"></li>
<li><a href="/clients/logout.php">Logout</a></li>

</ul>
</li>
</ul>


</div>
</div>



';

} 


?>


 

PS: If someone can confirm it's secure anyone reading this is free to use it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated