*/
session_start();
require_once 'include/lib/class.loginController.inc.php';
require_once 'PHPMailer_5.2.4/class.phpmailer.php';
$actionTaken = isset($_POST['actionTaken']) ? $_POST['actionTaken'] : '';
$signinAttempt = 0;
$registerAttempt = 0;
$signinEmail = '';
$objLoginController = new c_loginController();
if ($actionTaken == 'header-signup') {
    $signinAttempt = 1;
} elseif ($actionTaken == 'validate-member-login') {
    $signinEmail = isset($_POST['signinEmail']) ? $_POST['signinEmail'] : '';
    $password = isset($_POST['password']) ? $_POST['password'] : '';
    if ($objLoginController->isLoginValid($signinEmail, $password)) {
        $objLoginController->flagLoggedIn($signinEmail);
        $_SESSION['icaweb505a-user-id'] = $objLoginController->idUser;
        header("Location: index.php");
        // redirect to logged-in page
    } else {
        $signinAttempt = 1;
    }
} elseif ($actionTaken == 'register') {
    $firstname = isset($_POST['firstname']) ? $_POST['firstname'] : '';
    $lastname = isset($_POST['lastname']) ? $_POST['lastname'] : '';
    $signinEmail = isset($_POST['signinEmail']) ? $_POST['signinEmail'] : '';
    $password = isset($_POST['password']) ? $_POST['password'] : '';
    $idUser = '******';
    if ($objLoginController->registerNewUser($firstname, $lastname, $signinEmail, $password, $idUser)) {
        $objLoginController->flagLoggedIn($signinEmail);
        $_SESSION['icaweb505a-user-id'] = $objLoginController->idUser;
//
session_start();
require_once 'include/class.loginController.inc.php';
require_once 'include/class.generalHouseKeeping.inc.php';
require_once 'PHPMailer_5.2.4/class.phpmailer.php';
$objGeneralHouseKeeping = new c_generalHouseKeeping();
//--------------------------------------------
$actionTaken = isset($_POST['actionTaken']) ? $_POST['actionTaken'] : '';
$signinAttempt = 0;
$registerAttempt = 0;
$objLoginController = new c_loginController();
if ($actionTaken == 'validate-member-login') {
    $signinEmail = isset($_POST['signinEmail']) ? $_POST['signinEmail'] : '';
    $password = isset($_POST['password']) ? $_POST['password'] : '';
    if ($objLoginController->isLoginValid($signinEmail, $password)) {
        $objLoginController->flagLoggedIn($objLoginController->userID);
        $_SESSION['icaict515a-employee-id'] = $objLoginController->userID;
        header("Location: employee.php");
        // redirect to staff page
    } else {
        $signinAttempt = 1;
    }
} else {
    $userID = isset($_SESSION['icaict515a-employee-id']) ? $_SESSION['icaict515a-employee-id'] : "-1";
    if ($userID != '-1') {
        // reset all session variables and flag database as user logged out
        // return to statelessness
        //
        $_SESSION['icaict515a-employee-id'] = '-1';
        // remove the member ID
        $_SESSION = array();