Cookie Session Php

session_start(  );
if (isset($_SESSION['username'])) {
    $username=htmlentities($_SESSION['username']);
    echo "Hello $username";
} else {
    echo "Please login.";
}
?>