"", "result" => "", "mainte" => "", ); //---------------------------- // request parameter //---------------------------- $qToken = isset($_REQUEST["q_token"]) ? $_REQUEST["q_token"] : REQ_NON; $qName = isset($_REQUEST["q_name"]) ? $_REQUEST["q_name"] : REQ_NON; $qPassword = isset($_REQUEST["q_password"]) ? $_REQUEST["q_password"] : REQ_NON; $qLogout = isset($_REQUEST["q_logout"]) ? $_REQUEST["q_logout"] : REQ_NON; //---------------------------- // set types //---------------------------- Util::setType($qToken, "string"); Util::setType($qName, "string"); Util::setType($qPassword, "string"); Util::setType($qLogout, "int"); //---------------------------- // judge post //---------------------------- $isPost = ($qToken !== REQ_NON); //---------------------------- // validate request parameter //---------------------------- if ( $isPost ){ if ( ! Validate::isToken($qToken, "q_token_login") ){ $result = RES_NG; $gResult->push("{$WORD($wk, 1)}"); } if ( ! Validate::isString($qName) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 2)}"); } if ( ! Validate::isString($qPassword) ){ $result = RES_NG; $gResult->push("{$WORD($wk, 3)}"); } } //---------------------------- // process //---------------------------- if ( $result === RES_OK ){ if ( $isPost ){ if ( Auth::login($qName, $qPassword) ){ // ユーザートップへ if ( isset($_SESSION["requestUri"]) ){ $url = $_SESSION["requestUri"]; unset($_SESSION["requestUri"]); } else { $url = "/content/home/"; } header("Location: {$url}"); } else { $result = RES_NG; $gResult->push("{$WORD($wk, 4)}"); } } if ( $qLogout === ON ){ Auth::logout(); header("Location: /"); exit(); } } //---------------------------- // html //---------------------------- { // maintenance --------------------------------------------------------- $maintePath = Setting::get("PATH_ROOT")."/maintenance.php"; if ( file_exists($maintePath) ){ $arrHtml["mainte"] = include($maintePath); } // title --------------------------------------------------------------- $title = Config::get("SITE_TITLE"); $arrHtml["title"] = Printer::title($title); // form ---------------------------------------------------------------- $arrControl = array(); $arrAction = array(); // フォーム(ユーザー名) $arrControl[] = array( "id" => "q_name", "name" => "{$WORD($wk, 5)}", "form" => Printer::input("text", "q_name", "q_name", $qName), ); // フォーム(パスワード) $arrControl[] = array( "id" => "q_password", "name" => "{$WORD($wk, 6)}", "form" => Printer::input("password", "q_password", "q_password", ""), ); // フォーム(token) $arrControl[] = array( "id" => NULL, "name" => NULL, "form" => Printer::input("hidden", "q_token", "q_token", Util::token("q_token_login")), ); // フォーム(ログイン) $arrControl[] = array( "id" => NULL, "name" => NULL, "form" => Printer::input("submit", NULL, NULL, "{$WORD($wk, 7)}", "btn btn-primary"), ); $arrHtml["form"] = Printer::form("form_index", "form_index", "./", "post", $arrControl, $arrAction, NULL, FALSE); // result -------------------------------------------------------------- $arrHtml["result"] = $gResult->string(TRUE, $result); } ?>
Powered by Translation Tranining Platform of NICT