本文整理汇总了PHP中fn_token函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_token函数的具体用法?PHP fn_token怎么用?PHP fn_token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_token函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tplDisplay
/** 显示页面
* tplDisplay function.
*
* @access public
* @param mixed $str_tpl 模版名
* @param string $arr_tplData (default: "") 模版数据
* @return void
*/
function tplDisplay($str_tpl, $arr_tplData = "")
{
$this->common["token_session"] = fn_token();
//生成口令
$this->common["token_cookie"] = fn_cookie("token_cookie");
//输出cookie口令(特殊用途,用于上传)
$this->common["ssid"] = session_id();
//会话ID(特殊用途,用于上传)
if (BG_MODULE_GEN == false) {
unset($this->adminMod["gen"]);
}
$this->obj_smarty->assign("common", $this->common);
$this->obj_smarty->assign("config", $this->config);
$this->obj_smarty->assign("lang", $this->lang);
$this->obj_smarty->assign("status", $this->status);
$this->obj_smarty->assign("type", $this->type);
$this->obj_smarty->assign("alert", $this->alert);
$this->obj_smarty->assign("install", $this->install);
$this->obj_smarty->assign("opt", $this->opt);
$this->obj_smarty->assign("appMod", $this->appMod);
$this->obj_smarty->assign("adminMod", $this->adminMod);
$this->obj_smarty->assign("tplData", $arr_tplData);
$this->obj_smarty->display($str_tpl);
//显示
}
示例2: ajax_order
function ajax_order()
{
if (!isset($this->adminLogged["groupRow"]["group_allow"]["opt"]["custom"])) {
$this->obj_ajax->halt_alert("x200303");
}
if (!fn_token("chk")) {
//令牌
$this->obj_ajax->halt_alert("x030102");
}
$_num_customId = fn_getSafe(fn_post("custom_id"), "int", 0);
//ID
if ($_num_customId == 0) {
$this->obj_ajax->halt_alert("x200209");
}
$_arr_customRow = $this->mdl_custom->mdl_read($_num_customId);
if ($_arr_customRow["alert"] != "y200102") {
$this->obj_ajax->halt_alert($_arr_customRow["alert"]);
}
$_num_parentId = fn_getSafe(fn_post("custom_parent_id"), "int", 0);
$_str_orderType = fn_getSafe(fn_post("order_type"), "txt", "order_first");
$_num_targetId = fn_getSafe(fn_post("order_target"), "int", 0);
$_arr_customRow = $this->mdl_custom->mdl_order($_str_orderType, $_num_customId, $_num_targetId, $_num_parentId);
$this->misc_process();
$this->obj_ajax->halt_alert($_arr_customRow["alert"]);
}
示例3: tplDisplay
/** 显示页面
* tplDisplay function.
*
* @access public
* @param mixed $str_tpl 模版名
* @param string $arr_tplData (default: "") 模版数据
* @return void
*/
function tplDisplay($str_tpl, $arr_tplData = "")
{
$this->obj_smarty->assign("config", $this->config);
$this->obj_smarty->assign("lang", $this->lang);
$this->obj_smarty->assign("alert", $this->alert);
if (isset($this->arr_cfg["admin"])) {
$this->common["token_session"] = fn_token();
//生成令牌
//$this->common["token_cookie"] = fn_cookie("token_cookie"); //输出 cookie 令牌(特殊用途,用于上传)
//$this->common["ssid"] = session_id(); //会话 ID(特殊用途,用于上传)
$this->obj_smarty->assign("common", $this->common);
$this->obj_smarty->assign("status", $this->status);
$this->obj_smarty->assign("type", $this->type);
$this->obj_smarty->assign("install", $this->install);
$this->obj_smarty->assign("opt", $this->opt);
$this->obj_smarty->assign("appMod", $this->appMod);
$this->obj_smarty->assign("adminMod", $this->adminMod);
}
if (isset($this->arr_cfg["pub"])) {
$this->obj_smarty->registerPlugin("function", "call_display", "fn_callDisplay");
//注册自定义函数
$this->obj_smarty->registerPlugin("function", "call_attach", "fn_callAttach");
//注册自定义函数
$this->obj_smarty->registerPlugin("function", "call_cate", "fn_callCate");
//注册自定义函数
$this->obj_smarty->registerPlugin("modifier", "ubb", "fn_ubb");
}
$this->obj_smarty->assign("tplData", $arr_tplData);
$this->obj_smarty->display($str_tpl);
//显示
}
示例4: ajax_order
/**
* ajax_order function.
*
* @access public
* @return void
*/
function ajax_order()
{
if (!isset($this->adminLogged["groupRow"]["group_allow"]["cate"]["edit"])) {
$this->obj_ajax->halt_alert("x110303");
}
if (!fn_token("chk")) {
//令牌
$this->obj_ajax->halt_alert("x030102");
}
$_num_cateId = fn_getSafe(fn_post("cate_id"), "int", 0);
//ID
if ($_num_cateId == 0) {
$this->obj_ajax->halt_alert("x110217");
}
$_arr_cateRow = $this->mdl_cate->mdl_read($_num_cateId);
if ($_arr_cateRow["alert"] != "y110102") {
$this->obj_ajax->halt_alert($_arr_cateRow["alert"]);
}
$_num_parentId = fn_getSafe(fn_post("cate_parent_id"), "int", 0);
$_str_orderType = fn_getSafe(fn_post("order_type"), "txt", "order_first");
$_num_targetId = fn_getSafe(fn_post("order_target"), "int", 0);
$_arr_cateRow = $this->mdl_cate->mdl_order($_str_orderType, $_num_cateId, $_num_targetId, $_num_parentId);
$this->mdl_cate->mdl_cache(array($_num_cateId));
$this->obj_ajax->halt_alert($_arr_cateRow["alert"]);
}
示例5: ajax_make
/**
* ajax_check function.
*
* @access public
* @return void
*/
function ajax_make()
{
if ($this->adminLogged["alert"] == "y020102") {
$_str_token = fn_token();
//生成口令
$_str_alert = "y030102";
$_str_msg = "ok";
} else {
$_str_token = "none";
$_str_alert = "x020404";
$_str_msg = $this->obj_ajax->alert["x020404"];
}
$arr_re = array("token" => $_str_token, "alert" => $_str_alert, "msg" => $_str_msg);
exit(json_encode($arr_re));
}
示例6: tplDisplay
/** 显示界面
* tplDisplay function.
*
* @access public
* @param mixed $str_tpl
* @param string $arr_tplData (default: "")
* @return void
*/
function tplDisplay($str_tpl, $arr_tplData = "")
{
$this->common["tokenRow"] = fn_token();
$this->obj_smarty->assign("common", $this->common);
$this->obj_smarty->assign("config", $this->config);
$this->obj_smarty->assign("lang", $this->lang);
$this->obj_smarty->assign("status", $this->status);
$this->obj_smarty->assign("type", $this->type);
$this->obj_smarty->assign("allow", $this->allow);
$this->obj_smarty->assign("alert", $this->alert);
$this->obj_smarty->assign("install", $this->install);
$this->obj_smarty->assign("opt", $this->opt);
$this->obj_smarty->assign("adminMod", $this->adminMod);
$this->obj_smarty->assign("tplData", $arr_tplData);
$this->obj_smarty->display($str_tpl);
}
示例7: mdl_over
function mdl_over()
{
if (!fn_token("chk")) {
//令牌
return array("alert" => "x030102");
exit;
}
$_str_content = "<?php" . PHP_EOL;
$_str_content .= "define(\"BG_INSTALL_VER\", \"" . PRD_SSO_VER . "\");" . PHP_EOL;
$_str_content .= "define(\"BG_INSTALL_PUB\", " . PRD_SSO_PUB . ");" . PHP_EOL;
$_str_content .= "define(\"BG_INSTALL_TIME\", " . time() . ");" . PHP_EOL;
$_num_size = file_put_contents(BG_PATH_CONFIG . "is_install.php", $_str_content);
if ($_num_size > 0) {
$_str_alert = "y040101";
} else {
$_str_alert = "x040101";
}
return array("alert" => $_str_alert);
}
示例8: tplDisplay
/** 显示界面
* tplDisplay function.
*
* @access public
* @param mixed $str_view
* @param string $arr_tplData (default: "")
* @return void
*/
function tplDisplay($str_view, $arr_tplData = "")
{
$this->common["token_session"] = fn_token();
$this->common["ssid"] = session_id();
$this->common["view"] = $GLOBALS["view"];
$this->obj_smarty->assign("common", $this->common);
$this->obj_smarty->assign("config", $this->config);
$this->obj_smarty->assign("lang", $this->lang);
$this->obj_smarty->assign("status", $this->status);
$this->obj_smarty->assign("type", $this->type);
$this->obj_smarty->assign("allow", $this->allow);
$this->obj_smarty->assign("alert", $this->alert);
$this->obj_smarty->assign("install", $this->install);
$this->obj_smarty->assign("opt", $this->opt);
//if (isset($this->arr_cfg["admin"])) {
$this->obj_smarty->assign("adminMod", $this->adminMod);
//}
$this->obj_smarty->assign("tplData", $arr_tplData);
$this->obj_smarty->display($str_view);
}
示例9: tplDisplay
/** 显示界面
* tplDisplay function.
*
* @access public
* @param mixed $str_view
* @param string $arr_tplData (default: "")
* @return void
*/
function tplDisplay($str_view, $arr_tplData = "")
{
$this->common["token_session"] = fn_token();
if (fn_server("REQUEST_URI")) {
$this->common["thisUrl"] = base64_encode(fn_server("REQUEST_URI"));
}
$this->common["ssid"] = session_id();
$this->common["view"] = $GLOBALS["view"];
$this->obj_smarty->assign("common", $this->common);
$this->obj_smarty->assign("config", $this->config);
$this->obj_smarty->assign("lang", $this->lang);
$this->obj_smarty->assign("status", $this->status);
$this->obj_smarty->assign("type", $this->type);
$this->obj_smarty->assign("allow", $this->allow);
$this->obj_smarty->assign("alert", $this->alert);
$this->obj_smarty->assign("install", $this->install);
$this->obj_smarty->assign("opt", $this->opt);
$this->obj_smarty->assign("adminMod", $this->adminMod);
$this->obj_smarty->assign("tplData", $arr_tplData);
$this->obj_smarty->display($str_view);
}
示例10: check_db
private function check_db()
{
if (!fn_token("chk")) {
//令牌
$this->obj_ajax->halt_alert("x030214");
}
if (strlen(BG_DB_HOST) < 1 || strlen(BG_DB_NAME) < 1 || strlen(BG_DB_USER) < 1 || strlen(BG_DB_PASS) < 1 || strlen(BG_DB_CHARSET) < 1) {
$this->obj_ajax->halt_alert("x030412");
} else {
if (!defined("BG_DB_PORT")) {
define("BG_DB_PORT", "3306");
}
$_cfg_host = array("host" => BG_DB_HOST, "name" => BG_DB_NAME, "user" => BG_DB_USER, "pass" => BG_DB_PASS, "charset" => BG_DB_CHARSET, "debug" => BG_DEBUG_DB, "port" => BG_DB_PORT);
$GLOBALS["obj_db"] = new CLASS_MYSQLI($_cfg_host);
//设置数据库对象
$this->obj_db = $GLOBALS["obj_db"];
if (!$this->obj_db->connect()) {
$this->obj_ajax->halt_alert("x030111");
}
if (!$this->obj_db->select_db()) {
$this->obj_ajax->halt_alert("x030112");
}
}
}
示例11: input_ids
/** 选择 verify
* input_ids function.
*
* @access public
* @return void
*/
function input_ids()
{
if (!fn_token("chk")) {
//令牌
return array("alert" => "x030214");
}
$_arr_verifyIds = fn_post("verify_id");
if ($_arr_verifyIds) {
foreach ($_arr_verifyIds as $_key => $_value) {
$_arr_verifyIds[$_key] = fn_getSafe($_value, "int", 0);
}
$_str_alert = "ok";
} else {
$_str_alert = "none";
}
$this->verifyIds = array("alert" => $_str_alert, "verify_ids" => $_arr_verifyIds);
return $this->verifyIds;
}
示例12: 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;
}
示例13: input_ids
/** 选择短消息
* input_ids function.
*
* @access public
* @return void
*/
function input_ids()
{
if (!fn_token("chk")) {
//令牌
return array("alert" => "x030206");
}
$_arr_pmIds = fn_post("pm_ids");
if ($_arr_pmIds) {
foreach ($_arr_pmIds as $_key => $_value) {
$_arr_pmIds[$_key] = fn_getSafe($_value, "int", 0);
}
$_str_alert = "ok";
} else {
$_str_alert = "x030202";
}
$this->pmIds = array("alert" => $_str_alert, "pm_ids" => array_unique($_arr_pmIds));
return $this->pmIds;
}
示例14: ajax_submit
/**
* ajax_submit function.
*
* @access public
* @return void
*/
function ajax_submit()
{
if ($this->adminLogged["alert"] != "y020102") {
//未登录,抛出错误信息
$this->show_err($this->adminLogged["alert"]);
}
$_arr_status = $this->obj_upload->upload_init();
if ($_arr_status["alert"] != "y070403") {
$this->show_err($_arr_status["alert"]);
}
if (!isset($this->adminLogged["groupRow"]["group_allow"]["attach"]["upload"])) {
$this->show_err("x070302");
}
if (!fn_token("chk")) {
//令牌
$this->show_err("x030102");
}
if (!is_array($this->attachMime)) {
$this->show_err("x070405");
}
$_arr_uploadRow = $this->obj_upload->upload_pre();
if ($_arr_uploadRow["alert"] != "y100201") {
$this->show_err($_arr_uploadRow["alert"]);
}
$_arr_attachRow = $this->mdl_attach->mdl_submit(0, $_arr_uploadRow["attach_name"], $_arr_uploadRow["attach_ext"], $_arr_uploadRow["attach_mime"], $_arr_uploadRow["attach_size"], $this->adminLogged["admin_id"]);
if ($_arr_attachRow["alert"] != "y070101") {
$this->show_err($_arr_attachRow["alert"]);
}
$_arr_uploadRowSubmit = $this->obj_upload->upload_submit($_arr_attachRow["attach_time"], $_arr_attachRow["attach_id"]);
if ($_arr_uploadRowSubmit["alert"] != "y070401") {
$this->show_err($_arr_uploadRowSubmit["alert"]);
}
$_arr_uploadRowSubmit["attach_id"] = $_arr_attachRow["attach_id"];
$_arr_uploadRowSubmit["attach_ext"] = $_arr_uploadRow["attach_ext"];
$_arr_uploadRowSubmit["attach_name"] = $_arr_uploadRow["attach_name"];
exit(json_encode($_arr_uploadRowSubmit));
}
示例15: validate_import
private function validate_import()
{
if (!fn_token("chk")) {
//令牌
return array("alert" => "x030102");
exit;
}
$this->csvFiles = $_FILES["csv_files"];
$_str_alert = $this->upload_init($this->csvFiles["error"]);
if ($_str_alert != "ok") {
return array("alert" => $_str_alert);
exit;
}
$this->userImport["file_ext"] = pathinfo($this->csvFiles["name"], PATHINFO_EXTENSION);
//取得扩展名
$this->userImport["file_ext"] = strtolower($this->userImport["file_ext"]);
if ($this->userImport["file_ext"] != "csv") {
return array("alert" => "x010219");
exit;
}
$this->userImport["file_temp"] = $this->csvFiles["tmp_name"];
$this->userImport["alert"] = "ok";
return $this->userImport;
}