本文整理汇总了PHP中validateStr函数的典型用法代码示例。如果您正苦于以下问题:PHP validateStr函数的具体用法?PHP validateStr怎么用?PHP validateStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了validateStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_decode
/**
* api_decode function.
*
* @access public
* @return void
*/
function api_decode()
{
$this->app_check("post");
$_arr_code = validateStr(fn_post("code"), 1, 0);
switch ($_arr_code["status"]) {
case "too_short":
$_arr_return = array("alert" => "x080202");
$this->obj_api->halt_re($_arr_return);
break;
case "ok":
$_str_code = $_arr_code["str"];
break;
}
$_arr_key = validateStr(fn_post("key"), 1, 0);
switch ($_arr_key["status"]) {
case "too_short":
$_arr_return = array("alert" => "x080203");
$this->obj_api->halt_re($_arr_return);
break;
case "ok":
$_str_key = $_arr_key["str"];
break;
}
$_str_result = fn_baigoDecode($_str_code, $_str_key);
exit($_str_result);
}
示例2: mdl_const
function mdl_const($str_type)
{
if (!fn_token("chk")) {
//令牌
$this->obj_ajax->halt_alert("x030102");
}
$_arr_opt = fn_post("opt");
$_str_content = "<?php" . PHP_EOL;
foreach ($_arr_opt as $_key => $_value) {
$_arr_optChk = validateStr($_value, 1, 900);
$_str_optValue = $_arr_optChk["str"];
if (is_numeric($_value)) {
$_str_content .= "define(\"" . $_key . "\", " . $_str_optValue . ");" . PHP_EOL;
} else {
$_str_content .= "define(\"" . $_key . "\", \"" . str_replace(PHP_EOL, "|", $_str_optValue) . "\");" . PHP_EOL;
}
}
if ($str_type == "base") {
$_str_content .= "define(\"BG_SITE_SSIN\", \"" . fn_rand(6) . "\");" . PHP_EOL;
} else {
if ($str_type == "visit") {
if ($_arr_opt["BG_VISIT_TYPE"] != "static") {
$_str_content .= "define(\"BG_VISIT_FILE\", \"html\");" . PHP_EOL;
}
}
}
$_str_content = str_replace("||", "", $_str_content);
$_num_size = file_put_contents(BG_PATH_CONFIG . "opt_" . $str_type . ".inc.php", $_str_content);
if ($_num_size > 0) {
$_str_alert = "y060101";
} else {
$_str_alert = "x060101";
}
return array("alert" => $_str_alert);
}
示例3: ajax_submit
/**
* ajax_submit function.
*
* @access public
* @return void
*/
function ajax_submit()
{
$_arr_adminSubmit = $this->mdl_admin->input_submit();
if ($_arr_adminSubmit["alert"] != "ok") {
$this->obj_ajax->halt_alert($_arr_adminSubmit["alert"]);
}
$_str_adminPassDo = "";
$_str_adminRand = "";
if ($_arr_adminSubmit["admin_id"] > 0) {
if (!isset($this->adminLogged["admin_allow"]["admin"]["edit"]) && !$this->is_super) {
$this->obj_ajax->halt_alert("x020303");
}
if ($_arr_adminSubmit["admin_id"] == $this->adminLogged["admin_id"] && !$this->is_super) {
$this->obj_ajax->halt_alert("x020306");
}
$_str_adminPass = fn_post("admin_pass");
if (!fn_isEmpty($_str_adminPass)) {
$_str_adminRand = fn_rand(6);
$_str_adminPassDo = fn_baigoEncrypt($_str_adminPass, $_str_adminRand);
}
} else {
if (!isset($this->adminLogged["admin_allow"]["admin"]["add"]) && !$this->is_super) {
$this->obj_ajax->halt_alert("x020302");
}
$_arr_adminPass = validateStr(fn_post("admin_pass"), 1, 0);
switch ($_arr_adminPass["status"]) {
case "too_short":
$this->obj_ajax->halt_alert("x020205");
break;
case "ok":
$_str_adminPass = $_arr_adminPass["str"];
break;
}
$_str_adminRand = fn_rand(6);
$_str_adminPassDo = fn_baigoEncrypt($_str_adminPass, $_str_adminRand);
}
$_arr_adminRow = $this->mdl_admin->mdl_submit($_str_adminPassDo, $_str_adminRand);
if ($_arr_adminRow["alert"] == "y020101" || $_arr_adminRow["alert"] == "y020103") {
$_arr_targets[] = array("admin_id" => $_arr_adminRow["admin_id"]);
$_str_targets = json_encode($_arr_targets);
if ($_arr_adminRow["alert"] == "y020101") {
$_type = "add";
} else {
$_type = "edit";
}
$_str_adminRow = json_encode($_arr_adminRow);
$_arr_logData = array("log_targets" => $_str_targets, "log_target_type" => "admin", "log_title" => $this->log["admin"][$_type], "log_result" => $_str_adminRow, "log_type" => "admin");
$this->mdl_log->mdl_submit($_arr_logData, $this->adminLogged["admin_id"]);
}
$this->obj_ajax->halt_alert($_arr_adminRow["alert"]);
}
示例4: ajax_submit
/**
* ajax_submit function.
*
* @access public
* @return void
*/
function ajax_submit()
{
$_arr_adminSubmit = $this->mdl_admin->input_submit();
if ($_arr_adminSubmit["alert"] != "ok") {
$this->obj_ajax->halt_alert($_arr_adminSubmit["alert"]);
}
if ($_arr_adminSubmit["admin_id"] > 0) {
if (!isset($this->adminLogged["admin_allow"]["admin"]["edit"])) {
$this->obj_ajax->halt_alert("x020303");
}
if ($_arr_adminSubmit["admin_id"] == $this->adminLogged["admin_id"]) {
$this->obj_ajax->halt_alert("x020306");
}
$_arr_ssoGet = $this->obj_sso->sso_get($_arr_adminSubmit["admin_id"]);
if ($_arr_ssoGet["alert"] != "y010102") {
$this->obj_ajax->halt_alert($_arr_ssoGet["alert"]);
}
$_str_adminPass = fn_post("admin_pass");
$_arr_ssoEdit = $this->obj_sso->sso_edit($_arr_adminSubmit["admin_name"], "", $_str_adminPass, $_arr_adminSubmit["admin_mail"], $_arr_adminSubmit["admin_nick"]);
$_num_adminId = $_arr_adminSubmit["admin_id"];
} else {
if (!isset($this->adminLogged["admin_allow"]["admin"]["add"])) {
$this->obj_ajax->halt_alert("x020302");
}
$_arr_adminPass = validateStr(fn_post("admin_pass"), 1, 0);
switch ($_arr_adminPass["status"]) {
case "too_short":
$this->obj_ajax->halt_alert("x020210");
break;
case "ok":
$_str_adminPass = $_arr_adminPass["str"];
break;
}
$_arr_ssoReg = $this->obj_sso->sso_reg($_arr_adminSubmit["admin_name"], $_str_adminPass, $_arr_adminSubmit["admin_mail"], $_arr_adminSubmit["admin_nick"]);
if ($_arr_ssoReg["alert"] != "y010101") {
$this->obj_ajax->halt_alert($_arr_ssoReg["alert"]);
}
$_num_adminId = $_arr_ssoReg["user_id"];
}
$_arr_adminRow = $this->mdl_admin->mdl_submit($_num_adminId);
if ($_arr_ssoEdit["alert"] == "y010103" || $_arr_adminRow["alert"] == "y020103") {
$_str_alert = "y020103";
} else {
$_str_alert = $_arr_adminRow["alert"];
}
$this->obj_ajax->halt_alert($_str_alert);
}
示例5: app_get
/** 读取 app 信息
* app_get function.
*
* @access public
* @param bool $chk_token (default: false)
* @return void
*/
function app_get($str_method = "get", $chk_token = false)
{
if ($str_method == "post") {
$num_appId = fn_post("app_id");
$str_appKey = fn_post("app_key");
} else {
$num_appId = fn_get("app_id");
$str_appKey = fn_get("app_key");
}
$_arr_appId = validateStr($num_appId, 1, 0, "str", "int");
switch ($_arr_appId["status"]) {
case "too_short":
return array("alert" => "x190203");
exit;
break;
case "format_err":
return array("alert" => "x190204");
exit;
break;
case "ok":
$_arr_appGet["app_id"] = $_arr_appId["str"];
break;
}
$_arr_appKey = validateStr($str_appKey, 1, 64, "str", "alphabetDigit");
switch ($_arr_appKey["status"]) {
case "too_short":
return array("alert" => "x190214");
exit;
break;
case "too_long":
return array("alert" => "x190215");
exit;
break;
case "format_err":
return array("alert" => "x190216");
exit;
break;
case "ok":
$_arr_appGet["app_key"] = $_arr_appKey["str"];
break;
}
$_arr_appGet["alert"] = "ok";
return $_arr_appGet;
}
示例6: api_decode
/**
* api_decode function.
*
* @access public
* @return void
*/
function api_decode()
{
$this->app_check("post");
$_arr_code = validateStr(fn_post("code"), 1, 0);
switch ($_arr_code["status"]) {
case "too_short":
$_arr_return = array("alert" => "x050223");
$this->obj_api->halt_re($_arr_return);
break;
case "ok":
$_str_code = $_arr_code["str"];
break;
}
$_arr_sign = array("act_post" => $GLOBALS["act_post"], "code" => $_str_code);
if (!$this->obj_sign->sign_check(array_merge($this->appRequest, $_arr_sign), $this->appRequest["signature"])) {
$_arr_return = array("alert" => "x050403");
$this->obj_api->halt_re($_arr_return);
}
$_str_result = $this->obj_crypt->decrypt($_str_code, $this->appRow["app_key"]);
exit($_str_result);
}
示例7: api_verify
/**
* api_verify function.
*
* @access public
* @return void
*/
function api_verify()
{
$this->app_check("post");
$_arr_params = fn_post("params");
$_arr_signature = validateStr(fn_post("signature"), 1, 0);
switch ($_arr_signature["status"]) {
case "too_short":
$_arr_return = array("alert" => "x050226");
$this->obj_api->halt_re($_arr_return);
break;
case "ok":
$_str_sign = $_arr_signature["str"];
break;
}
if ($this->obj_sign->sign_check($_arr_params, $_str_sign)) {
$_str_alert = "y050403";
} else {
$_str_alert = "x050403";
}
$_arr_return = array("alert" => $_str_alert);
$this->obj_api->halt_re($_arr_return);
}
示例8: ajax_admin
function ajax_admin()
{
$this->check_db();
include_once BG_PATH_MODEL . "admin.class.php";
//载入管理帐号模型
$_mdl_admin = new MODEL_ADMIN();
$_arr_adminSubmit = $_mdl_admin->input_submit();
if ($_arr_adminSubmit["alert"] != "ok") {
$this->obj_ajax->halt_alert($_arr_adminSubmit["alert"]);
}
$_arr_adminPass = validateStr(fn_post("admin_pass"), 1, 0);
switch ($_arr_adminPass["status"]) {
case "too_short":
$this->obj_ajax->halt_alert("x020205");
break;
case "ok":
$_str_adminPass = $_arr_adminPass["str"];
break;
}
$_arr_adminPassConfirm = validateStr(fn_post("admin_pass_confirm"), 1, 0);
switch ($_arr_adminPassConfirm["status"]) {
case "too_short":
$this->obj_ajax->halt_alert("x020211");
break;
case "ok":
$_str_adminPassConfirm = $_arr_adminPassConfirm["str"];
break;
}
if ($_str_adminPass != $_str_adminPassConfirm) {
$this->obj_ajax->halt_alert("x020206");
}
$_str_adminRand = fn_rand(6);
$_str_adminPassDo = fn_baigoEncrypt($_str_adminPass, $_str_adminRand);
$_arr_adminRow = $_mdl_admin->mdl_submit($_str_adminPassDo, $_str_adminRand);
$this->obj_ajax->halt_alert("y030407");
}
示例9: ajax_submit
function ajax_submit()
{
$_arr_userSubmit = $this->mdl_user->input_submit();
$_str_userPassDo = "";
$_str_userRand = "";
if ($_arr_userSubmit["alert"] != "ok") {
$this->obj_ajax->halt_alert($_arr_userSubmit["alert"]);
}
if ($_arr_userSubmit["user_id"] > 0) {
if (!isset($this->adminLogged["admin_allow"]["user"]["edit"])) {
$this->obj_ajax->halt_alert("x010303");
}
$_str_userPass = fn_post("user_pass");
if ($_str_userPass) {
$_str_userRand = fn_rand(6);
$_str_userPassDo = fn_baigoEncrypt($_str_userPass, $_str_userRand);
}
} else {
if (!isset($this->adminLogged["admin_allow"]["user"]["add"])) {
$this->obj_ajax->halt_alert("x010302");
}
$_arr_userPass = validateStr(fn_post("user_pass"), 1, 0);
switch ($_arr_userPass["status"]) {
case "too_short":
$this->obj_ajax->halt_alert("x010212");
break;
case "ok":
$_str_userPass = $_arr_userPass["str"];
break;
}
$_str_userRand = fn_rand(6);
$_str_userPassDo = fn_baigoEncrypt($_str_userPass, $_str_userRand);
}
$_arr_userRow = $this->mdl_user->mdl_submit($_str_userPassDo, $_str_userRand);
$this->obj_ajax->halt_alert($_arr_userRow["alert"]);
}
示例10: input_dbconfig
function input_dbconfig()
{
$_arr_dbHost = validateStr(fn_post("db_host"), 1, 0);
switch ($_arr_dbHost["status"]) {
case "too_short":
return array("alert" => "x030204");
exit;
break;
case "ok":
$this->dbconfig["db_host"] = $_arr_dbHost["str"];
break;
}
$_arr_dbPort = validateStr(fn_post("db_port"), 1, 0);
switch ($_arr_dbPort["status"]) {
case "too_short":
return array("alert" => "x030211");
exit;
break;
case "ok":
$this->dbconfig["db_port"] = $_arr_dbPort["str"];
break;
}
$_arr_dbName = validateStr(fn_post("db_name"), 1, 0);
switch ($_arr_dbName["status"]) {
case "too_short":
return array("alert" => "x030205");
exit;
break;
case "ok":
$this->dbconfig["db_name"] = $_arr_dbName["str"];
break;
}
$_arr_dbUser = validateStr(fn_post("db_user"), 1, 0);
switch ($_arr_dbUser["status"]) {
case "too_short":
return array("alert" => "x030206");
exit;
break;
case "ok":
$this->dbconfig["db_user"] = $_arr_dbUser["str"];
break;
}
$_arr_dbPass = validateStr(fn_post("db_pass"), 1, 0);
switch ($_arr_dbPass["status"]) {
case "too_short":
return array("alert" => "x030207");
exit;
break;
case "ok":
$this->dbconfig["db_pass"] = $_arr_dbPass["str"];
break;
}
$_arr_dbCharset = validateStr(fn_post("db_charset"), 1, 0);
switch ($_arr_dbCharset["status"]) {
case "too_short":
return array("alert" => "x030208");
exit;
break;
case "ok":
$this->dbconfig["db_charset"] = $_arr_dbCharset["str"];
break;
}
$_arr_dbTable = validateStr(fn_post("db_table"), 1, 0);
switch ($_arr_dbTable["status"]) {
case "too_short":
return array("alert" => "x030209");
exit;
break;
case "ok":
$this->dbconfig["db_table"] = $_arr_dbTable["str"];
break;
}
$this->dbconfig["alert"] = "ok";
return $this->dbconfig;
}
示例11: input_login
/**
* 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;
}
示例12: notify_input
/** 读取 app 信息
* app_get function.
*
* @access public
* @param bool $chk_token (default: false)
* @return void
*/
function notify_input($str_method = "get", $chk_token = false)
{
switch ($str_method) {
case "post":
$_str_time = fn_post("time");
$_str_signature = fn_post("signature");
$_str_code = fn_post("code");
$this->jsonp_callback = fn_post("callback");
$_arr_notifyInput["act_post"] = fn_post("act_post");
break;
default:
$_str_time = fn_get("time");
$_str_signature = fn_get("signature");
$_str_code = fn_get("code");
$this->jsonp_callback = fn_get("callback");
$_arr_notifyInput["act_get"] = fn_get("act_get");
break;
}
$_arr_time = validateStr($_str_time, 1, 0);
switch ($_arr_time["status"]) {
case "too_short":
return array("alert" => "x220201");
break;
case "ok":
$_arr_notifyInput["time"] = $_arr_time["str"];
break;
}
$_arr_signature = validateStr($_str_signature, 1, 0);
switch ($_arr_signature["status"]) {
case "too_short":
return array("alert" => "x220203");
break;
case "ok":
$_arr_notifyInput["signature"] = $_arr_signature["str"];
break;
}
$_arr_code = validateStr($_str_code, 1, 0);
switch ($_arr_code["status"]) {
case "too_short":
return array("alert" => "x220204");
break;
case "ok":
$_arr_notifyInput["code"] = $_arr_code["str"];
break;
}
$_arr_notifyInput["alert"] = "ok";
return $_arr_notifyInput;
}
示例13: input_submit
function input_submit()
{
if (!fn_token("chk")) {
//令牌
return array("alert" => "x030102");
exit;
}
$this->tagSubmit["tag_id"] = fn_getSafe(fn_post("tag_id"), "int", 0);
if ($this->tagSubmit["tag_id"] > 0) {
$_arr_tagRow = $this->mdl_read($this->tagSubmit["tag_id"]);
if ($_arr_tagRow["alert"] != "y130102") {
return $_arr_tagRow;
exit;
}
}
$_arr_tagName = validateStr(fn_post("tag_name"), 1, 30);
switch ($_arr_tagName["status"]) {
case "too_short":
return array("alert" => "x130201");
exit;
break;
case "too_long":
return array("alert" => "x130202");
exit;
break;
case "ok":
$this->tagSubmit["tag_name"] = $_arr_tagName["str"];
break;
}
$_arr_tagRow = $this->mdl_read($this->tagSubmit["tag_name"], "tag_name", $this->tagSubmit["tag_id"]);
if ($_arr_tagRow["alert"] == "y130102") {
return array("alert" => "x130203");
exit;
}
$_arr_tagStatus = validateStr(fn_post("tag_status"), 1, 0);
switch ($_arr_tagStatus["status"]) {
case "too_short":
return array("alert" => "x130204");
exit;
break;
case "ok":
$this->tagSubmit["tag_status"] = $_arr_tagStatus["str"];
break;
}
$this->tagSubmit["alert"] = "ok";
return $this->tagSubmit;
}
示例14: input_verify
function input_verify()
{
if (!fn_token("chk")) {
//令牌
return array("alert" => "x030214");
}
$_arr_verifyId = validateStr(fn_post("verify_id"), 1, 0);
switch ($_arr_verifyId["status"]) {
case "too_short":
return array("alert" => "x120201");
break;
case "ok":
$this->verifySubmit["verify_id"] = $_arr_verifyId["str"];
break;
}
$_arr_verifyToken = validateStr(fn_post("verify_token"), 1, 0);
switch ($_arr_verifyToken["status"]) {
case "too_short":
return array("alert" => "x120202");
break;
case "ok":
$this->verifySubmit["verify_token"] = $_arr_verifyToken["str"];
break;
}
$this->verifySubmit["alert"] = "ok";
return $this->verifySubmit;
}
示例15: input_submit
function input_submit()
{
if (!fn_token("chk")) {
//令牌
return array("alert" => "x030102");
exit;
}
$this->callSubmit["call_id"] = fn_getSafe(fn_post("call_id"), "int", 0);
if ($this->callSubmit["call_id"] > 0) {
$_arr_callRow = $this->mdl_read($this->callSubmit["call_id"]);
if ($_arr_callRow["alert"] != "y170102") {
return $_arr_callRows;
exit;
}
}
$_arr_callName = validateStr(fn_post("call_name"), 1, 300);
switch ($_arr_callName["status"]) {
case "too_short":
return array("alert" => "x170201");
exit;
break;
case "too_long":
return array("alert" => "x170202");
exit;
break;
case "ok":
$this->callSubmit["call_name"] = $_arr_callName["str"];
break;
}
$_arr_callType = validateStr(fn_post("call_type"), 1, 0);
switch ($_arr_callType["status"]) {
case "too_short":
return array("alert" => "x170204");
exit;
break;
case "ok":
$this->callSubmit["call_type"] = $_arr_callType["str"];
break;
}
$_arr_callStatus = validateStr(fn_post("call_status"), 1, 0);
switch ($_arr_callStatus["status"]) {
case "too_short":
return array("alert" => "x170206");
exit;
break;
case "ok":
$this->callSubmit["call_status"] = $_arr_callStatus["str"];
break;
}
$this->callSubmit["call_file"] = fn_getSafe(fn_post("call_file"), "txt", "");
$this->callSubmit["call_attach"] = fn_getSafe(fn_post("call_attach"), "txt", "");
$this->callSubmit["call_cate_id"] = fn_getSafe(fn_post("call_cate_id"), "int", 0);
$this->callSubmit["call_spec_id"] = fn_getSafe(fn_post("call_spec_id"), "int", 0);
$this->callSubmit["call_cate_ids"] = fn_jsonEncode(fn_post("call_cate_ids"), "no");
$this->callSubmit["call_cate_excepts"] = fn_jsonEncode(fn_post("call_cate_excepts"), "no");
$this->callSubmit["call_mark_ids"] = fn_jsonEncode(fn_post("call_mark_ids"), "no");
$this->callSubmit["call_amount"] = fn_jsonEncode(fn_post("call_amount"), "no");
$this->callSubmit["alert"] = "ok";
return $this->callSubmit;
}