<?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 = man_power::authenticate($username, $password); $found_sm = man_power::sm_authenticate($username, $password); $found_tm = man_power::tm_authenticate($username, $password); if ($found_bdm) { $_SESSION['bdm'] = $found_bdm->smsWayID; $_SESSION['bdmname'] = $found_bdm->BM_Name; $_SESSION['bdmzone'] = $found_bdm->Zone; $_SESSION['bdmemp'] = $found_bdm->BM_Emp_Id; $_SESSION['sm_emp'] = $found_bdm->SM_Emp_Id; redirect_to("bmdashboard.php"); } elseif ($found_sm) { $_SESSION['smsWayID'] = $found_sm->smsWayID; $_SESSION['smname'] = $found_sm->SM_Name; $_SESSION['smzone'] = $found_sm->Zone; $_SESSION['smemp'] = $found_sm->SM_Emp_Id; redirect_to("SMDashboard.php"); } elseif ($found_tm) { $_SESSION['smsWayID'] = $found_tm->smsWayID; $_SESSION['tmname'] = $found_tm->TM_Name; $_SESSION['tmzone'] = $found_tm->Zone; $_SESSION['tmemp'] = $found_tm->TM_Emp_Id;