Показывать имя пользователя после входа пользователя в систему

Привет, я пытаюсь отобразить имя пользователя после входа в систему.

вот мой код

Это страница, которую я хотел бы показать. index.php

<?php require_once 'classes/Membership.php'; $membership = New Membership(); $membership->confirm_Member(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Home Page</title> <link href="css/me.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"> </div> <div id="top-register"> <? $_SESSION['username'] ?> <a href="login.php?status=loggedout"> Log Out </a> </div> <div id="top-login"> <a href="index.php"> </a> </div> <div id="line"> <div id="banner-text"> Testing </div> <div id="banner"> </div> </div> <center> <div id="plan"> <div id="plan-innder"> <a href="index.php"><img src="images/plan/starter.png" alt="Starter" width="250" height="300" /></a> <a href="index.php"><img src="images/plan/regular.png" alt="Regular" width="250" height="300" /></a> <a href="index.php"><img src="images/plan/advanced.png" alt="Advanced" width="250" height="300" /></a> </div> </div> enter code here </center> </body> </html> 

Работы membership.php

 <?php require 'Mysql.php'; class Membership { function validate_user($un, $pwd) { $mysql = New Mysql(); $ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd)); if($ensure_credentials) { $_SESSION['status'] = 'authorized'; header("location: index.php"); } else return "Please enter a correct username and password"; } function log_User_Out() { if(isset($_SESSION['status'])) { unset($_SESSION['status']); if(isset($_COOKIE[session_name()])) setcookie(session_name(), '', time() - 1000); session_destroy(); } } function confirm_Member() { session_start(); if($_SESSION['status'] !='authorized') header("location: login.php"); } } с <?php require 'Mysql.php'; class Membership { function validate_user($un, $pwd) { $mysql = New Mysql(); $ensure_credentials = $mysql->verify_Username_and_Pass($un, md5($pwd)); if($ensure_credentials) { $_SESSION['status'] = 'authorized'; header("location: index.php"); } else return "Please enter a correct username and password"; } function log_User_Out() { if(isset($_SESSION['status'])) { unset($_SESSION['status']); if(isset($_COOKIE[session_name()])) setcookie(session_name(), '', time() - 1000); session_destroy(); } } function confirm_Member() { session_start(); if($_SESSION['status'] !='authorized') header("location: login.php"); } } 

Mysql.php

Это то, что связано с базой данных.

 require_once 'includes/constants.php'; class Mysql { private $conn; function __construct() { $this->conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database.'); } function verify_Username_and_Pass($un, $pwd) { $query = "SELECT * FROM users WHERE username = ? AND password = ? LIMIT 1"; if($stmt = $this->conn->prepare($query)) { $stmt->bind_param('ss', $un, $pwd); $stmt->execute(); if($stmt->fetch()) { $stmt->close(); return true; } } } }