Exemplo n.º 1
0
<?php

/* Start the session */
session_start();
require_once 'Models/DataSetClient.php';
$view = new stdClass();
$view->pageTitle = 'Login';
/* Log out the user, if it clicks on Logout button */
if (isset($_POST['logout'])) {
    unset($_SESSION['username']);
}
/* Check if the user exists, if not then login the user */
if (isset($_POST['login'])) {
    $emailAddress = $_POST['username'];
    $password = $_POST['password'];
    $loginDataSetClient = new DataSetClient();
    $login = $loginDataSetClient->fetchClient($emailAddress, md5($password));
    if ($login !== false) {
        $_SESSION['username'] = $emailAddress;
    }
}
require_once 'Views/login.phtml';