/**
* 检查hash值,验证用户数据安全性
*/
| 代码如下 | 复制代码 |
| final private function check_hash() { if(preg_match('/^public_/', ROUTE_A) || ROUTE_M =='admin' && ROUTE_C =='index' || in_array(ROUTE_A, array('login'))) { return true; } if(isset($_GET['pc_hash']) && $_SESSION['pc_hash'] != '' && ($_SESSION['pc_hash'] == $_GET['pc_hash'])) { return true; } elseif(isset($_POST['pc_hash']) && $_SESSION['pc_hash'] != '' && ($_SESSION['pc_hash'] == $_POST['pc_hash'])) { return true; } else { showmessage(L('hash_check_false'),HTTP_REFERER); } } |
|
phpcms给函数进行了hash验证,因此,现在方法是这样写的:
| 代码如下 | 复制代码 |
| public function public_mobile_getjson_ids() {//publc是后来加上去的 $modelid = intval($_GET['modelid']); $id = intval($_GET['id']); $this->db->set_model($modelid); $tablename = $this->db->table_name; $this->db->table_name = $tablename.'_data'; $r = $this->db->get_one(array('id'=>$id),'mobile_type'); if($r['mobile_type']) { $relation = str_replace('|', ',', $r['mobile_type']); $relation = trim($relation,','); $where = "id IN($relation)"; $infos = array(); $this->mobile_db = pc_base::load_model ( 'mobile_type_model' ); $datas = $this->mobile_db->select($where,'id,type_name'); //$this->db->table_name = $tablename; //$datas = $this->db->select($where,'id,title'); foreach($datas as $_v) { $_v['sid'] = 'v'.$_v['id']; if(strtolower(CHARSET)=='gbk') $_v['type_name'] = iconv('gbk', 'utf-8', $_v['type_name']); $infos[] = $_v; } echo json_encode($infos); } } |
|
js部分的getJSON是这样写的:
| 代码如下 | 复制代码 |
| //显示添加机型 function show_mobiletype(modelid,id) { $.getJSON("?m=content&c=content&a=public_mobile_getjson_ids&modelid="+modelid+"&id="+id, function(json){ var newrelation_ids = ''; if(json==null) { alert('没有添加相www.111com.net关文章'); return false; } $.each(json, function(i, n){ newrelation_ids += " }); $('#mobile_type_text').html(newrelation_ids); }); } |
|
就好了。要注意phpcms里面调用远程地址,方法前加上public啊!!
原文来自: 感谢 小谈博客
原神祈愿模拟器最新版
原神祈愿模拟器手机版是一款完整汉化的趣味原神抽卡模拟小游戏,
宝宝森林美食完整版
宝宝森林美食游戏最新版是一款十分有趣的休闲益智游戏,帮助宝宝
g沙盒仇恨官方英文版(gorebox)
G沙盒仇恨英文原版是一款最近非常火热的沙盒模拟类游戏,在这里
迷你世界测试服最新版2024
迷你世界测试服2021最新版,即迷你世界的先遣服版本,用户能
闪耀暖暖最新版2024
闪耀暖暖手游这是非常好玩的换装手游,游戏内容丰富有趣,游戏环