<?

//將頁面處理值送回主模組	

function main_page()
{	
	global $action;
	
	//流程控制
	switch ($action)
	{   
      		
		//確認資料
   		case "step1":      	
      		$buffer = step1();      		
      		break;
        
	        //預設畫面(提示報名注意事項)
   		default:
      		$buffer = step0();      		
      		break;
	}	
	
	return $buffer;
}


//預設頁	
function step0()
{
	global $page;

	$buffer = "<br>";
	
	$array['{TOP1_A}'] = "熱　情";
	$array['{TOP1_B}'] = "智　慧";
	$array['{TOP1_C}'] = "科　技";
	
	$buffer .= read_and_parser("top1.php",$array);	
	unset($array);	
	
	$array['{MIDDLE_PANEL_TITLE}'] = '系統管理者者 - 登入';
	$array['{MIDDLE_PANEL_CONTENT}'] = "<form method=GET action=administrator.php>";
	$array['{MIDDLE_PANEL_CONTENT}'] .= "<input type=hidden name=page value=$page>";
	$array['{MIDDLE_PANEL_CONTENT}'] .= "<input type=hidden name=action value=step1>";
	$array['{MIDDLE_PANEL_CONTENT}'] .= file_get_contents('require/admin0.htm');
	$array['{MIDDLE_PANEL_CONTENT}'] .= "</form>";
	
	$buffer .= read_and_parser("middle.php",$array);
	unset($array);
	
	return $buffer;
}

//處理登入
function step1()
{
	global $page,$temp_array,$uid;	
	
	if(!$temp_array[0]) error_message("您的【帳號】欄沒有輸入唷!");
	if(!$temp_array[1]) error_message("您的【密碼】欄沒有輸入唷!");
	
	if($temp_array[0]!='Administrator'||$temp_array[1]!='admin') error_message("帳號密碼錯誤，請勿以身試法");	
	pass_message("恭喜您! 登入完成!");
	$uid = '930001';
	
	$buffer = "<br>";
	
	$array['{TOP1_A}'] = "熱　情";
	$array['{TOP1_B}'] = "智　慧";
	$array['{TOP1_C}'] = "科　技";
	
	$buffer .= read_and_parser("top1.php",$array);
	unset($array);
	
	
	$array['{MIDDLE_PANEL_TITLE}'] = '系統管理者者 - 登入完成';
	$array['{MIDDLE_PANEL_CONTENT}'] = file_get_contents('require/admin1.htm');
	
	$buffer .= read_and_parser("middle.php",$array);
	unset($array);	
	
	return $buffer;
}
?>