Esempio n. 1
0
 /**
  * fn_adminLogin function.
  *
  * @access public
  * @return void
  */
 private function input_login()
 {
     $_arr_adminLogin["forward"] = fn_getSafe(fn_post("forward"), "txt", "");
     if (!$_arr_adminLogin["forward"]) {
         $_arr_adminLogin["forward"] = base64_encode(BG_URL_ADMIN . "ctl.php");
     }
     if (!fn_seccode()) {
         //验证码
         return array("forward" => $_arr_adminLogin["forward"], "alert" => "x030101");
         exit;
     }
     if (!fn_token("chk")) {
         //令牌
         return array("forward" => $_arr_adminLogin["forward"], "alert" => "x030102");
         exit;
     }
     $_arr_adminName = validateStr(fn_post("admin_name"), 1, 30, "str", "strDigit");
     switch ($_arr_adminName["status"]) {
         case "too_short":
             return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020201");
             exit;
             break;
         case "too_long":
             return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020202");
             exit;
             break;
         case "format_err":
             return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020203");
             exit;
             break;
         case "ok":
             $_arr_adminLogin["admin_name"] = $_arr_adminName["str"];
             break;
     }
     $_arr_adminPass = validateStr(fn_post("admin_pass"), 1, 0);
     switch ($_arr_adminPass["status"]) {
         case "too_short":
             return array("forward" => $_arr_adminLogin["forward"], "alert" => "x020208");
             exit;
             break;
         case "ok":
             $_arr_adminLogin["admin_pass"] = $_arr_adminPass["str"];
             break;
     }
     $_arr_adminLogin["alert"] = "ok";
     $_arr_adminLogin["view"] = fn_getSafe(fn_post("view"), "txt", "");
     return $_arr_adminLogin;
 }
Esempio n. 2
0
 /** 登录验证
  * input_login function.
  *
  * @access public
  * @return void
  */
 function input_login()
 {
     $this->adminLogin["forward"] = fn_getSafe(fn_post("forward"), "txt", "");
     if (fn_isEmpty($this->adminLogin["forward"])) {
         $this->adminLogin["forward"] = fn_forward(BG_URL_ADMIN . "ctl.php");
     }
     if (!fn_seccode()) {
         //验证码
         return array("forward" => $this->adminLogin["forward"], "alert" => "x030205");
     }
     if (!fn_token("chk")) {
         //令牌
         return array("forward" => $this->adminLogin["forward"], "alert" => "x030206");
     }
     $_arr_adminName = validateStr(fn_post("admin_name"), 1, 30, "str", "strDigit");
     switch ($_arr_adminName["status"]) {
         case "too_short":
             return array("forward" => $this->adminLogin["forward"], "alert" => "x020201");
             break;
         case "too_long":
             return array("forward" => $this->adminLogin["forward"], "alert" => "x020202");
             break;
         case "format_err":
             return array("forward" => $this->adminLogin["forward"], "alert" => "x020203");
             break;
         case "ok":
             $this->adminLogin["admin_name"] = $_arr_adminName["str"];
             break;
     }
     $_arr_adminPass = validateStr(fn_post("admin_pass"), 1, 0);
     switch ($_arr_adminPass["status"]) {
         case "too_short":
             return array("forward" => $this->adminLogin["forward"], "alert" => "x020205");
             break;
         case "ok":
             $this->adminLogin["admin_pass"] = $_arr_adminPass["str"];
             break;
     }
     $this->adminLogin["alert"] = "ok";
     return $this->adminLogin;
 }