Пример #1
0
 /** 验证 app
  * app_chk function.
  *
  * @access public
  * @param mixed $arr_appRequest
  * @param mixed $arr_appRow
  * @return void
  */
 function app_chk($arr_appRequest, $arr_appRow)
 {
     if ($arr_appRequest["alert"] != "ok") {
         return $arr_appRow;
     }
     if ($arr_appRow["app_status"] != "enable") {
         return array("alert" => "x050402");
     }
     $_str_ip = fn_getIp();
     if ($arr_appRow["app_ip_allow"]) {
         $_str_ipAllow = str_ireplace(PHP_EOL, "|", $arr_appRow["app_ip_allow"]);
         if (!fn_regChk($_str_ip, $_str_ipAllow, true)) {
             return array("alert" => "x050212");
         }
     } else {
         if ($arr_appRow["app_ip_bad"]) {
             $_str_ipBad = str_ireplace(PHP_EOL, "|", $arr_appRow["app_ip_bad"]);
             if (fn_regChk($_str_ip, $_str_ipBad)) {
                 return array("alert" => "x050213");
             }
         }
     }
     if ($arr_appRow["app_key"] != $arr_appRequest["app_key"]) {
         return array("alert" => "x050217");
     }
     return array("alert" => "ok");
 }
Пример #2
0
 /** api 编辑
  * api_edit function.
  *
  * @access public
  * @return void
  */
 function api_edit()
 {
     $_arr_userGet = $this->input_get_by("post");
     if ($_arr_userGet["alert"] != "ok") {
         return $_arr_userGet;
         exit;
     }
     $this->apiEdit = $_arr_userGet;
     if (fn_post("user_mail")) {
         $_arr_userMail = $this->input_mail_chk(fn_post("user_mail"));
         if ($_arr_userMail["alert"] != "ok") {
             return $_arr_userMail;
             exit;
         }
         $this->apiEdit["user_mail"] = $_arr_userMail["user_mail"];
         if (defined("BG_ACC_MAIL") && strlen(BG_ACC_MAIL)) {
             if (!fn_regChk($this->apiEdit["user_mail"], BG_ACC_MAIL)) {
                 return array("alert" => "x010209");
                 exit;
             }
         } else {
             if (defined("BG_BAD_MAIL") && strlen(BG_BAD_MAIL)) {
                 if (fn_regChk($this->apiEdit["user_mail"], BG_BAD_MAIL)) {
                     return array("alert" => "x010210");
                     exit;
                 }
             }
         }
     }
     $this->apiEdit["user_check_pass"] = fn_getSafe(fn_post("user_check_pass"), "txt", "");
     if ($this->apiEdit["user_check_pass"] == true) {
         $_arr_userPass = $this->input_pass_chk(fn_post("user_pass"));
         if ($_arr_userPass["alert"] != "ok") {
             return $_arr_userPass;
             exit;
         }
         $this->apiEdit["user_pass"] = $_arr_userPass["user_pass"];
     }
     if (fn_post("user_pass_new")) {
         $this->apiEdit["user_pass_new"] = fn_post("user_pass_new");
         $this->apiEdit["user_rand"] = fn_rand(6);
         $this->apiEdit["user_pass_do"] = fn_baigoEncrypt($this->apiEdit["user_pass_new"], $this->apiEdit["user_rand"], true);
     }
     $_arr_userNick = $this->input_nick_chk(fn_post("user_nick"));
     if ($_arr_userNick["alert"] != "ok") {
         return $_arr_userNick;
         exit;
     }
     $this->apiEdit["user_nick"] = $_arr_userNick["user_nick"];
     $this->apiEdit["alert"] = "ok";
     return $this->apiEdit;
 }
Пример #3
0
 /**
  * chk_user_mail function.
  *
  * @access public
  * @param mixed $str_mail
  * @param mixed $num_mailMin
  * @return void
  */
 private function chk_user_mail($str_mail, $num_min = 0)
 {
     if (BG_REG_NEEDMAIL == "on" || BG_LOGIN_MAIL == "on" || $num_min > 0) {
         $_num_mailMin = 1;
     } else {
         $_num_mailMin = 0;
     }
     $_arr_userMail = validateStr($str_mail, $_num_mailMin, 300, "str", "email");
     switch ($_arr_userMail["status"]) {
         case "too_short":
             return array("alert" => "x010206");
             break;
         case "too_long":
             return array("alert" => "x010207");
             break;
         case "format_err":
             return array("alert" => "x010208");
             break;
         case "ok":
             $_str_userMail = $_arr_userMail["str"];
             if (defined("BG_ACC_MAIL") && strlen(BG_ACC_MAIL) && $_str_userMail) {
                 if (!fn_regChk($_str_userMail, BG_ACC_MAIL)) {
                     return array("alert" => "x010209");
                 }
             } else {
                 if (defined("BG_BAD_MAIL") && strlen(BG_BAD_MAIL) && $_str_userMail) {
                     if (fn_regChk($_str_userMail, BG_BAD_MAIL)) {
                         return array("alert" => "x010210");
                     }
                 }
             }
             break;
     }
     return array("user_mail" => $_str_userMail, "alert" => "ok");
 }