Skip to content

Commit

Permalink
1. 修复调用代理接口限制来源的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shinn-lancelot committed Sep 10, 2018
1 parent f3d53d0 commit cf665ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
// 限制来源
$referer = getReferer();
$domain = $referer != '' ? parse_url($referer)['host'] : '';
$domain || exit('禁止访问!');
$code = $_GET['code'];
$domain || $code || exit('禁止访问!');
$file = './common/domainName.json';
if (file_exists($file)) {
if (file_exists($file) && $domain) {
$domainNameArr = json_decode(file_get_contents($file), true);
count($domainNameArr) > 0 && !in_array($domain, $domainNameArr) && exit('禁止访问!代理接口安全域名校验出错!');
}

$code = $_GET['code'];
$proxyScope = $_REQUEST['proxy_scope'];
$proxyScope = $proxyScope ? $proxyScope : 'code'; // 代理操作作用域,默认仅获取code 'code':仅获取code 'access_token':获取access_token及openid
$state = $_REQUEST['state'];
Expand Down

0 comments on commit cf665ce

Please sign in to comment.