<?
class logout{
	function logout($keluar){
		if ($keluar=md5("logoutuser")){

			$module = "Logout";
			$sql = "Logout from PMS";
			audittrail_add($module, $sql, 'Logout');

			unset($_SESSION['Xuserpkey'],$_SESSION['Xusergrouppkey'],$_SESSION['Xusername'],$_SESSION['Xuserrole'],$_SESSION['Xlogintime']);
			unset($_SESSION['Xstaffpkey'],$_SESSION['staffno'],$_SESSION['Xstaffnricno'],$_SESSION['Xstafftitle'],$_SESSION['Xstaffname'],$_SESSION['Xstaffrole'],$_SESSION['Xstaffdesignation'],$_SESSION['Xstaffdivpkey'],$_SESSION['Xstaffdeptpkey']);
			unset($_SESSION['Xcssfile'],$_SESSION['Xuseraccess'],$_SESSION['Xerrormessage'],$_SESSION['Xpreviousurl']);
			unset($_SESSION['Xgroupname'],$_SESSION['Xprojectpkey'],$_SESSION['Xprojectid'],$_SESSION['Xprojectname'],$_SESSION['Xprojectdesc'],$_SESSION['Xactivetab'],$_SESSION['Xprevmodule']);

			session_destroy();
			$logoutGoTo = "index.php";
			echo goto($logoutGoTo);
			exit;
		}
	}//end function logout
}
?>