<?php
/*
* @author Bulent Tezcan. bulent@greenpepper.ca
*/
require_once "Security.class.php";
session_start( );
ob_start( );
include "header.inc.php";
if ($_GET['mode'] == 'logout')
{
$_SESSION['myAccount'] = null;
$_SESSION['myHierarchy'] = null;
}
$mySecurity = new Security( );
if ($_GET['mode'] == 'logout')
{
$mySecurity-> GotoThisPage( GOTO_PAGE_AFTER_LOGOUT );
}
$FormElements = $_POST["form_login"];
$FormElements['__error'] = "";
if ($FormElements['username'] == "" or
$FormElements['password'] == "")
$FormElements['__error'] = "Please enter username and password";
else
{
if (!$mySecurity-> VerifyUser($FormElements['username'],
$FormElements['password']))
$FormElements['__error'] = $mySecurity-> GetErrorMessage( );
else
{
$_SESSION['myAccount'] = $mySecurity-> GetAccountID( );
$_SESSION['myHierarchy']= $mySecurity-> GetHierarchy( );
$mySecurity-> SuccessfulLogin( );
}
}
if ($FormElements['__error'] == "")
{
$_SESSION['loginPrompting'] = null;
header("Location: ".$_SESSION['http_referer']);
exit;
}
$mySecurity-> PromptLogin($FormElements);
include "footer.inc.php";
ob_end_flush( );
return true;
?>
|