This is a simple task... you need to add the columns to your database entering time of login and holding a place for the last login.
then when authenticating someone who logs in, you would call there username to display add last login date to the query and store it in the session.
then make a place for it in your header and echo it.
it would look like this..
this is the file which authenticates and stores the session variables when someone logs in. im obviously posting the section which would execute on a successful login.
if ($username==$dbusername&&$password==$dbpassword)
{
echo("Successful Login!");
session_start();
$_SESSION['username'] = $username;
$_SESSION['LastLoginDate'] = $LastLoginDate;
header("Location:UserHomePage.php");
then you would simple echo the information you just stored in the session in the page that you send them to when they log in. in this example is it UserHomePage.php
notice we session start and then create security so if there is no session username stored we redirect to index.php. but since there is a username stored it shows in the title of the page username 's Dashboard.
then to echo out the LastLoginDate in this example we do the same thing anywhere on the page. in this example im just using echo to call out the LastLoginDate in the middle of the page
<?php
session_start();
if (!isset($_SESSION['username'])){
header("Location:index.php");
exit();
}
?>
<?php
if (isset($_SESSION['username'])){
echo "<b>welcome</b>";
}else{
header("Location:index.php");} ?>
<html lang="en">
<head>
<title><?php echo $_SESSION['username']; ?>'s Dashboard</title>
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
</head>
<body>
<div class="container">
<?php echo $_SESSION['LastLoginDate']; ?>
<a href="logout.php">Logout</a>
</div>
<div class="navigate">
<?php include 'nav.php' ?>
</div>
</body>
</html>