title: Show username for logged users and sign up/login links for others
body: <p>I really need help for my login script. I want to show some PHP codes to show username for logged-in users else for others show only login/signup link.</p>
  
  <p>Codes given below.</p>
  
  <pre><code>/*---Logged in user's homepage---*/
  
  
  &lt;?PHP
  
  require_once('../lib/connections/db.php');
  
  include('../lib/functions/functions.php');
  
  checkLogin('2');
  
  $getuser = getUserRecords($_SESSION['user_id']);
  
  ?&gt;
  
  &lt;html&gt;
  
  &lt;head&gt;
  
  &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
  
  &lt;title&gt;&lt;?=$getuser[0]['username'];?&gt;'s Profile Page | HDS Web&lt;/title&gt;
  
  &lt;?php include('../headother.php'); ?&gt;
  
  &lt;div style="background:#FFFFFF; padding-bottom:150px; padding-top:15px;"&gt;
  
  
  /*----User's photo and details section goes below----*/
  
  
  &lt;div style="float:left; width:600px;"&gt;  
  
  &lt;p&gt;
  Welcome &lt;?php if(empty($getuser[0]['first_name']) || empty($getuser[0]['last_name'])){echo $getuser[0]['username'];} else {echo $getuser[0]['first_name']." ".$getuser[0]['last_name'];} ?&gt;&lt;/p&gt;                       
  
   &lt;? displayUserImg($getuser[0]['id']); ?&gt;
  
  &lt;/div&gt;
  
  
  /*---User's navigation menu section goes below---*/
  
  
  &lt;div style="float:right; width:200px;"&gt; 
  
      &lt;a href="index.php"&gt;Home&lt;/a&gt; | &lt;? if (!empty($getuser[0]['thumb_path'])){echo "&lt;a href='manage_photo.php'&gt;Manage My Photo&lt;/a&gt; | ";} else {echo "&lt;a href='upload_photo.php'&gt;Upload Photo&lt;/a&gt; | ";} ?&gt;
  
  &lt;a href="change_pass.php"&gt;change password&lt;/a&gt; | 
  
  &lt;a href="edit_profile.php"&gt;Edit Profile&lt;/a&gt; 
  
  | &lt;a href="log_off.php?action=logoff"&gt;sign out&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;
  
  
      &lt;/div&gt;
      &lt;?php include('../footer.php');?&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>