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.
Codes given below.
/*---Logged in user's homepage---*/
<?PHP
require_once('../lib/connections/db.php');
include('../lib/functions/functions.php');
checkLogin('2');
$getuser = getUserRecords($_SESSION['user_id']);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=$getuser[0]['username'];?>'s Profile Page | HDS Web</title>
<?php include('../headother.php'); ?>
<div style="background:#FFFFFF; padding-bottom:150px; padding-top:15px;">
/*----User's photo and details section goes below----*/
<div style="float:left; width:600px;">
<p>
Welcome <?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'];} ?></p>
<? displayUserImg($getuser[0]['id']); ?>
</div>
/*---User's navigation menu section goes below---*/
<div style="float:right; width:200px;">
<a href="index.php">Home</a> | <? if (!empty($getuser[0]['thumb_path'])){echo "<a href='manage_photo.php'>Manage My Photo</a> | ";} else {echo "<a href='upload_photo.php'>Upload Photo</a> | ";} ?>
<a href="change_pass.php">change password</a> |
<a href="edit_profile.php">Edit Profile</a>
| <a href="log_off.php?action=logoff">sign out</a></div></td>
</div>
<?php include('../footer.php');?>
</body>
</html>