Session using the proper $_SESSION super global
<?php session_start( ); if (isset($_SESSION['username'])) { $username=htmlentities($_SESSION['username']); echo "Hello $username"; } else { echo "Please login."; } ?>