From ceee6e7c3fa05d869a2ee3c4bfda5a034670f448 Mon Sep 17 00:00:00 2001 From: shinn-lancelot <945226793@qq.com> Date: Sat, 25 Aug 2018 13:55:48 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=AE=8C=E5=96=84=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E9=AA=8C=E8=AF=81=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E3=80=81=E5=AE=89=E5=85=A8=E5=9F=9F=E5=90=8D=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- admin.php | 7 +- asset/image/back.png | Bin 0 -> 43005 bytes common/addSafeDomainName.php | 47 +++++ common/clearDomainName.php | 51 +++++ common/clearVerify.php | 35 ++++ common/loginHandle.php | 32 +-- common/verifyHandle.php | 9 + login.php | 5 +- manageDomainName.php | 296 +++++++++++++++++++++++++++ manageVerify.php | 293 ++++++++++++++++++++++++++ safeDomainName.php | 386 +++++++++++++++++++++++++++++++++++ verify.php | 41 ++-- 13 files changed, 1163 insertions(+), 42 deletions(-) create mode 100644 asset/image/back.png create mode 100644 common/addSafeDomainName.php create mode 100644 common/clearDomainName.php create mode 100644 common/clearVerify.php create mode 100644 manageDomainName.php create mode 100644 manageVerify.php create mode 100644 safeDomainName.php 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 0000000000000000000000000000000000000000..420c18c3a51c47f80e52c7fae897157028683f3d GIT binary patch literal 43005 zcmeHQ30zF;`#)2mqGXLoQ{mco_eZwuaYI6~rw}TIiY&>#D@#aFE!aa_n48HcJz>x|f?vw<1EM5n6h zrKKx0t*Y0kvfXUh#YJ~D%>q_D-PtJIzWb^bBUcX_-QkVF!{8J1=cK2l<=)Rdld?S} zFV^E`Wv?n#8?Jw`Ybw*xa%pFi2L|4Q%r0Jy^iru|mZZklc@cBozT72-$x!u}?df`? zTORMQGo!+|+-*_6>Xj#-7e`n$9M169Gf75OQ!4U&EScyQL!+xR(Y2T(L;jec$!ua6 zM~`_ujF|me%_2Jg*Ta+w@iOiY&*tue0{4Y-+=J`Soaao#A&-VS3i9c0-kKuDY|;t#e5s<6M@8 zoAH>a7~dOPe!JDSdbsajdb8eTBt12JdfxG9kMX*VbtY*f8*Sg>Z(PkRMb$jE62s`_ z#Qj;&p_@<2i{vLSCZ#y0f4H=(z#+rgsH@@I#DX(xRMZ%qfj86R$31_3Pu1lL?}*zu zhmcWBycIJ!F=tHM1dW{|HUFBEv)ZFWo@u?nAdBeE`gJucR!nPP8x+~<+3K#J+dgql zTJ4#Iy9EhzGMMSxO#KcYqZxv
&KWGziU3DddIb+O+Wc0MDyFM%3F1&Z|hA9j}2D6qvB?I zYM+7Ls>?fP#<{kuJjQGDE{8b1+HPZT5C^Q^Y{4CYnJ!6 zS!u1;@Jda)=hp45yxZI9TmR3!MxCg@@#*UIRaSddd#yfpiOzY)MLs@#t<9}_?rZSc z_;}R__2C+em$W|ri_yk?gN`?tQ#I$}Y+I9~KGuCg8@@5DXBgOE>@V8Y#%(mKuYGkx z@<2_)20m^2RqW?rmSEO=&yYP`Z|O|gZr(7}$LZ?hWc6cSq5LiD!+a|H4BC);^+Ix3 zb(2dgo|HMrb@*T(9?*zqZ_R_@~0ll$VP?%&MfdOl$EK z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yA5KfUGWe3Qy;o{QHfuoI86whzY`%`3ynd{Vtl-eUIb4hvV?aHeh4A-5yTBEE?vwTe111c)vx!! KUWa$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 @@ - 微信授权回调域名验证操作 + 添加微信公众号授权登录域名验证文件内容