require_once "pre.php";
/*************** *************** FUNCTION AND ACTION - START *************** ***************/
// Get the menu option chosen
$menuOption = "$defaultMenuOption";
if(isset($_GET['menuOption'])) {
$menuOption = strtoupper($_GET['menuOption']);
}
else if(isset($_POST['menuOption'])) {
$menuOption = strtoupper($_POST['menuOption']);
}
else {
header("Location: index.php?menuOption=$defaultMenuOption");
}
// Get the action that needs to be performed
$action = "";
if(isset($_GET['action'])) {
$action = strtoupper($_GET['action']);
}
else if(isset($_POST['action'])) {
$action = strtoupper($_POST['action']);
}
/*************** *************** FUNCTION AND ACTION - END *************** ***************/
/**
* Login and logout is the only functions that are performed in index.php
* because the access rights are needed in the menu and headers as well,
* the rest of the actions are performed in the content sections before
* output is generated.
*/
// Login or Logout
if($menuOption == "LOGIN") {
if ($action == "LOGIN") {
if(isset($_POST['username']) && isset($_POST['password'])){
if (!$currentSession->authenticate($_POST['username'],$_POST['password'])) {
$currentSession->authenticate("$guestAccount","$guestPassword");
$loginSuccess = false;
}
else {
echo "SUCCESS";
}
}
}
else if ($action == "LOGOUT") {
$currentSession->authenticate("$guestAccount","$guestPassword");
}
}
?>
=$siteOwner->companySiteName; ?>
if ($currentSession->username == "$guestAccount") {
?>LOGIN
}
else {
$fullName = $dUser->getFullname($currentSession->user_id);
echo "You are currently logged in as $fullName. ";
if ($dUser->usingDBPassword($currentSession->user_id) && $currentSession->username != "holcim") {
?> CHANGE PASSWORD |
}
?> LOGOUT
}
?>
// include the content component
include "$filePath/include/content.inc.php";
?>
// include the footer details
//include("$filePath/include/footer.inc.php");
?>