2-1
index.php
<?php
/*引入檔案(初始設定)*/
require_once 'config.php';
require_once 'smarty/libs/Smarty.class.php';
$smarty = new Smarty;
// $smarty->clearAllCache();
/*過濾變數*/
$name = isset($_POST['email']) ? filter_var($_POST['email'], FILTER_SANITIZE_SPECIAL_CHARS) : "訪客";
$pass = isset($_POST['pass']) ? $_POST['pass'] : "";
$op = isset($_REQUEST['op']) ? filter_var($_REQUEST['op'], FILTER_SANITIZE_SPECIAL_CHARS) : "";
$content = "主內容";
/*執行流程*/
switch ($op) {
case 'login':
$content = ($name == $admin_id and $pass == $admin_pass) ? "登入成功" : "登入失敗";
break;
default:
# 取得活動列表
break;
}
/*輸出結果*/
$smarty->assign('name', $name);
$smarty->assign('content', $content);
$smarty->assign('page_title', '活動報名系統');
$smarty->display('index.tpl');