Exemple #1
0
<?php

require_once "./includes/initialize.php";
$errors = array();
session_start();
if (isset($_POST['submit'])) {
    // Form has been submitted.
    $username = trim($_POST['username']);
    $password = trim($_POST['password']);
    // Check database to see if username/password exist.
    $found_bdm = bdm::authenticate($username, $password);
    $found_ho = ho::authenticate($username, $password);
    $found_task = task::auth($username, $password);
    if ($found_bdm) {
        $_SESSION['bdm'] = $found_bdm->bdm_id;
        $_SESSION['bdmname'] = $found_bdm->bdm_name;
        $_SESSION['bdmzone'] = $found_bdm->zone;
        redirect_to("dashboard.php");
    } elseif ($found_ho) {
        //        session_start();
        $_SESSION['ho'] = $found_ho->id;
        redirect_to("dashboard.php");
    } elseif ($found_task) {
        //       session_start();
        $_SESSION['taskforce'] = $found_task->tfid;
        $_SESSION['tfname'] = $found_task->name;
        $_SESSION['tfzone'] = $found_task->zone;
        redirect_to("dashboard.php");
    } else {
        $message = "Incorrect Username/Password.";
        flashMessage($message, 'error');