Ejemplo n.º 1
0
/favicon.ico">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="<?php 
echo $path->getAssetPath();
?>
/css/notes.css"/>
</head>
<body>

<header class="header">
    <?php 
// ================================================================================================================
// LOGIN
if (isset($_POST['username']) && isset($_POST['password'])) {
    // try to log in.
    if ($authHandler->loginUser($_POST['username'], $_POST['password'])) {
        echo "<div class='notification success'>Hi " . $authHandler->getUserName() . ", you are now logged in!</div>";
    } else {
        echo "<div class='notification error'>We're sorry, but the log in failed. Is the password correct?</div>";
    }
}
// LOGOUT
if (isset($_POST['logout'])) {
    $authHandler->logoutUser();
}
// ================================================================================================================
?>
    <div class="brand">Notes</div>

    <?php 
if ($authHandler->isUserLoggedIn()) {