'; echo '名稱:
'; echo '密碼:
'; echo ''; echo ''; } header("Content-Type:text/html; charset=utf-8"); require_once('auth.php'); $options = array( // 設定參數陣列 'users' => array( // 使用者名稱與密碼陣列 'mary' => '123', 'tony' => '456', 'admin' => '789')); // 建立驗證物件, 指定用 showform() 函式顯示表單 $a = new Auth('Array',$options, 'showform'); // 若使用者按了網頁中的『登出』連結 (在後面的 if 段落中輸出) // 就呼叫 logout() 方法將使用者登出 if ($_GET['logout']=='true') $a->logout(); $a->start(); // 呼叫 start() 方法啟始驗證程序 // 若使用者尚未登入, 會輸出內建的登入表單 ?> 自訂PEAR::Auth登入表單 ' . 'PEAR::Auth 網頁
'; // 呼叫 checkAuth() 方法檢查目前使用者是否已登入 // 已登入時, 才會輸出以下內容 if($a->checkAuth()) { echo $a->getUsername() . ', 歡迎!
'; echo '登出
'; } ?>