diff --git a/.gitignore b/.gitignore index 0ef04d1..3da3316 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .DS_Store /.cache /.vscode -*.txt \ No newline at end of file +*.txt +domainName.json \ No newline at end of file diff --git a/admin.php b/admin.php index 762a908..2d61d5f 100644 --- a/admin.php +++ b/admin.php @@ -164,12 +164,12 @@
-

添加微信公众号授权登录txt验证内容

+

添加微信公众号授权登录域名验证文件内容

- +
-

添加接口允许域名

+

添加接口调用安全域名

@@ -214,7 +214,6 @@ } else { logoutState = 1; } - } else { console.log(xhr.readyState); } diff --git a/asset/image/back.png b/asset/image/back.png new file mode 100644 index 0000000..420c18c Binary files /dev/null and b/asset/image/back.png differ diff --git a/common/addSafeDomainName.php b/common/addSafeDomainName.php new file mode 100644 index 0000000..7903a05 --- /dev/null +++ b/common/addSafeDomainName.php @@ -0,0 +1,47 @@ +$value) { + if ($value == $domainName) { + $hasDomainName = true; + break; + } + } + } + + if (!$hasDomainName) { + array_unshift($domainNameArr, $domainName); + file_put_contents('./domainName.json', json_encode($domainNameArr)); + } + + $res['code'] = 1; + $res['message'] = '提交成功!'; + echo json_encode($res); +} \ No newline at end of file diff --git a/common/clearDomainName.php b/common/clearDomainName.php new file mode 100644 index 0000000..42a3096 --- /dev/null +++ b/common/clearDomainName.php @@ -0,0 +1,51 @@ +$value) { + if ($value == $domainName) { + $hasDomainName = true; + unset($domainNameArr[$key]); + break; + } + } + } + + if (!$hasDomainName) { + $res['message'] = '域名不存在!'; + echo json_encode($res); + exit(); + } + + file_put_contents('./domainName.json', json_encode($domainNameArr)); + + $res['code'] = 1; + $res['message'] = '移除成功!'; + echo json_encode($res); +} \ No newline at end of file diff --git a/common/clearVerify.php b/common/clearVerify.php new file mode 100644 index 0000000..253321f --- /dev/null +++ b/common/clearVerify.php @@ -0,0 +1,35 @@ +$value) { - if ($value['user'] == $user) { - $hasUser = true; - if ($value['password'] == md5($password . $salt)) { - session_start(); - $_SESSION['wop_admin_user'] = $user; + if (count($userArr) > 0) { + foreach ($userArr as $key=>$value) { + if ($value['user'] == $user) { + $hasUser = true; + if ($value['password'] == md5($password . $salt)) { + session_start(); + $_SESSION['wop_admin_user'] = $user; - $res['code'] = 1; - $res['message'] = '登录成功!'; - } else { - $res['message'] = '密码错误!'; + $res['code'] = 1; + $res['message'] = '登录成功!'; + } else { + $res['message'] = '密码错误!'; + } + break; } - break; } } if (!$hasUser) { diff --git a/common/verifyHandle.php b/common/verifyHandle.php index d8dda76..41f4e48 100644 --- a/common/verifyHandle.php +++ b/common/verifyHandle.php @@ -4,6 +4,15 @@ $res['code'] = 0; $res['message'] = '提交失败!'; + session_start(); + $user = isset($_SESSION['wop_admin_user']) ? $_SESSION['wop_admin_user'] : ''; + if (empty($user)) { + $res['code'] = -1; + $res['message'] = '登陆过期!'; + echo json_encode($res); + exit(); + } + $filePrefix = 'MP_verify_'; $callBackUrl = $_SERVER['HTTP_HOST']; diff --git a/login.php b/login.php index de12615..fadf21f 100644 --- a/login.php +++ b/login.php @@ -206,12 +206,12 @@
- +
- +

登录

@@ -275,7 +275,6 @@ } else { loginState = 1; } - } else { console.log(xhr.readyState); } diff --git a/manageDomainName.php b/manageDomainName.php new file mode 100644 index 0000000..5848dc9 --- /dev/null +++ b/manageDomainName.php @@ -0,0 +1,296 @@ + + + + + + + + + 添加接口调用安全域名 + + + + + +
+
+
+
+

+

退出登录

+
+
+
    + 0) { + foreach ($domainNameArr as $key=>$value) { + echo '
  • + ' . $value .' + +
  • '; + } + } else { + echo '
  • 暂无安全域名
  • '; + } + ?> +
+
+
+
+ + + + \ No newline at end of file diff --git a/manageVerify.php b/manageVerify.php new file mode 100644 index 0000000..7460877 --- /dev/null +++ b/manageVerify.php @@ -0,0 +1,293 @@ + + + + + + + + + 添加接口调用安全域名 + + + + + +
+
+
+
+

+

退出登录

+
+
+
    + 0) { + foreach ($verifyArr as $key=>$value) { + echo '
  • + ' . $value .' + +
  • '; + } + } else { + echo '
  • 暂无验证文件
  • '; + } + ?> +
+
+
+
+ + + + \ No newline at end of file diff --git a/safeDomainName.php b/safeDomainName.php new file mode 100644 index 0000000..36b0176 --- /dev/null +++ b/safeDomainName.php @@ -0,0 +1,386 @@ + + + + + + + + + 添加接口调用安全域名 + + + + + +
+
+
+
+

+

退出登录

+
+
+ +
+
+ + +
+
+

提交

+
+ +
+

管理接口调用安全域名

+
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/verify.php b/verify.php index abcb1d1..1fa413b 100644 --- a/verify.php +++ b/verify.php @@ -13,7 +13,7 @@ - 微信授权回调域名验证操作 + 添加微信公众号授权登录域名验证文件内容