1、找到api/libs下的checkApp.class.php,65行把
- $checkAppSecret = $this->checkAppSecret($appsecret);
改成:
- $checkAppSecret = $this->checkSafecode($appsecret);
然后再下边新增一个函数:(76行后边)
- /*
- ** 检测safecode
- */
- public function checkSafecode($safecode){
- $flag = 1;
- $app = $this->app;
- $mdappid = md5(md5($app['appid']));
- if (empty($safecode) || $mdappid != trim($safecode)) {
- $flag = 0;
- }
- return $flag;
- }
2、找到phpcms\modules\xiaochengxu\xiaochengxu.php找到80行左右的代码:
- extract($info);
在前面新增代码:
- $safecode = md5(md5($info['appid']));
3、找到phpcms\modules\xiaochengxu\templates\xiaochengxu_edit.tpl.php在44行后边新增代码:
- <tr>
- <th width="100"><?php echo L('safecode')?>:</th>
- <td><?php echo $safecode?></td>
- </tr>
4、登录后台--小程序---小程序列表---编辑---复制safecode放到小程序app.js的safecode的位置即可,
目前这种方法安全性不是很高,后续会再次做进一步调整的