{"id":34,"date":"2022-06-29T09:42:56","date_gmt":"2022-06-29T01:42:56","guid":{"rendered":"http:\/\/blog.naspro.cc\/?p=34"},"modified":"2024-02-03T13:49:13","modified_gmt":"2024-02-03T05:49:13","slug":"php%e4%b8%ba%e4%bb%bb%e6%84%8f%e9%a1%b5%e9%9d%a2%e8%ae%be%e8%ae%bf%e9%97%ae%e5%af%86%e7%a0%81%ef%bc%8c%e9%9c%80%e8%a6%81%e7%99%bb%e9%99%86%e6%89%8d%e8%83%bd%e8%ae%bf%e9%97%ae","status":"publish","type":"post","link":"http:\/\/blog.naspro.cc\/?p=34","title":{"rendered":"PHP\u4e3a\u4efb\u610f\u9875\u9762\u8bbe\u8bbf\u95ee\u5bc6\u7801\uff0c\u9700\u8981\u767b\u9646\u624d\u80fd\u8bbf\u95ee"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-flat ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/blog.naspro.cc\/?p=34\/#%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95\" title=\"\u4f7f\u7528\u65b9\u6cd5\">\u4f7f\u7528\u65b9\u6cd5<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/blog.naspro.cc\/?p=34\/#%e4%bb%a3%e7%a0%81%e7%ae%80%e4%bb%8b\" title=\"\u4ee3\u7801\u7b80\u4ecb\">\u4ee3\u7801\u7b80\u4ecb<\/a><\/li><li class='ez-toc-page-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/blog.naspro.cc\/?p=34\/#%e4%bb%a3%e7%a0%81%e5%a6%82%e4%b8%8b\" title=\"\u4ee3\u7801\u5982\u4e0b\">\u4ee3\u7801\u5982\u4e0b<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95\"><\/span>\u4f7f\u7528\u65b9\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u628a\u4e0b\u9762\u7684\u4ee3\u7801\u5b58\u4e3aphp\u6587\u4ef6\uff0c\u4e0b\u9762\u7684\u6574\u6bb5\u4ee3\u7801\u662f\u9a8c\u8bc1\u8fc7\u7a0b\uff0c\u7136\u540e\u5728\u4f60\u5165\u53e3\u9875\u8fdb\u884c\u8c03\u7528<br \/>\n\u4f8b\u5982\u547d\u540d\u4e3aMkEncrypt.php\uff0c\u90a3\u4e48\u5728\u5165\u53e3\u9875<br \/>\n\u8fdb\u884c<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-php\">require_once(&#039;MkEncrypt.php&#039;);\nMkEncrypt(&#039;1234&#039;);<\/code><\/pre>\n<p>\u7136\u540e\u8bbe\u7f6e\u5bc6\u7801\u4e3a<\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-php\">MkEncrypt(&#039;1234&#039;);<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/blog.naspro.cc\/wp-content\/uploads\/2022\/03\/21aebf5ef8645dde6ab5ecf7236d5902_20201227214240-1024x528-93fcfe62d1174c6892d276fffce2a277.png\" alt=\"21aebf5ef8645dde6ab5ecf7236d5902_202012272142401024x528.png\" \/><\/p>\n<pre class=\"prettyprint linenums\" ><code class=\"language-PHP\">&lt;?phprequire_once(&#039;MkEncrypt.php&#039;);\nMkEncrypt(&#039;3322211&#039;); ?&gt;<\/code><\/pre>\n<p>\u5c06\u4e0a\u9762\u4ee3\u7801\u63d2\u5165\u5230 php\u9875\u9762 <code><code> &lt;\/head&gt; <\/code><\/code>\u4e0b<\/p>\n<p>\u5219\u5bc6\u7801\u6b63\u786e\u624d\u80fd\u8fdb\u53bb\u9875\u9762\uff0c\u8fdb\u5165\u540e\u4f1a\u5b58\u4e0bcookies\u503c\uff0c\u4e0b\u4e00\u6b21\u767b\u5f55\u7684\u65f6\u5019\u5219\u4e0d\u9700\u8981\u518d\u6b21\u8f93\u5165\u4e86\uff1b\u5982\u679c\u4e0d\u60f3\u7ed9\u4eba\u770b\u4e86\uff0c\u53ea\u9700\u8981\u66f4\u6539\u5bc6\u7801\uff0ccookies\u5c31\u4f1a\u7acb\u5373\u5931\u6548\uff0c\u5fc5\u987b\u8981\u91cd\u65b0\u767b\u9646\u624d\u80fd\u770b\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%e4%bb%a3%e7%a0%81%e7%ae%80%e4%bb%8b\"><\/span>\u4ee3\u7801\u7b80\u4ecb<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u4e3a\u4f60\u7684\u9875\u9762 \u652f\u6301 \u52a0\u5bc6\u8bbf\u95ee \u65e0\u8bba\u4ec0\u4e48\u7a0b\u5e8f \u53ea\u8981\u662fPHP\u7a0b\u5e8f \u90fd\u662f\u652f\u6301\u8fd9\u4ee3\u7801\u7684 \u6765\u5b9e\u73b0\u52a0\u5bc6\u8bbf\u95ee\u4f60\u7684\u52a0\u5bc6\u9875\u9762 \u6216\u6587\u7ae0\u7b49\u7b49\u7684\u9875\u9762 \u4e0d\u4fdd\u8bc1\u5176\u4ed6\u7a0b\u5e8f\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528 \u9ebb\u70e6\u5148\u6d4b\u8bd5\uff01<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%e4%bb%a3%e7%a0%81%e5%a6%82%e4%b8%8b\"><\/span>\u4ee3\u7801\u5982\u4e0b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre class=\"prettyprint linenums\" ><code class=\"language-php\">&lt;?php\n\/********************************************\n * \u4f7f\u7528\u65b9\u6cd5:\n * \n * 1\u3001\u5c06\u672c\u6bb5\u4ee3\u7801\u4fdd\u5b58\u4e3a MkEncrypt.php\n * \n * 2\u3001\u5728\u8981\u52a0\u5bc6\u7684\u9875\u9762\u524d\u9762\u5f15\u5165\u8fd9\u4e2a php \u6587\u4ef6   \n *  require_once(&#039;MkEncrypt.php&#039;);\n * \n * 3\u3001\u8bbe\u7f6e\u9875\u9762\u8bbf\u95ee\u5bc6\u7801 \n *  MkEncrypt(&#039;\u9875\u9762\u5bc6\u7801&#039;);\n * \n********************************************\/\n\n\/\/ \u5bc6\u7801 Cookie \u52a0\u5bc6\u76d0\nif(!defined(&#039;MK_ENCRYPT_SALT&#039;))\n    define(&#039;MK_ENCRYPT_SALT&#039;, &#039;Kgs$JC!V&#039;);\n\n\/**\n * \u8bbe\u7f6e\u8bbf\u95ee\u5bc6\u7801\n * \n * @param $password  \u8bbf\u95ee\u5bc6\u7801\n * @param $pageid    \u9875\u9762\u552f\u4e00 ID \u503c\uff0c\u7528\u4e8e\u533a\u5206\u540c\u4e00\u7f51\u7ad9\u7684\u4e0d\u540c\u52a0\u5bc6\u9875\u9762\n *\/\nfunction MkEncrypt($password, $pageid = &#039;default&#039;) {\n    $pageid     = md5($pageid);\n    $md5pw      = md5(md5($password).MK_ENCRYPT_SALT);\n    $postpwd    = isset($_POST[&#039;pagepwd&#039;]) ? addslashes(trim($_POST[&#039;pagepwd&#039;])) : &#039;&#039;;\n    $cookiepwd  = isset($_COOKIE[&#039;mk_encrypt_&#039;.$pageid]) ? addslashes(trim($_COOKIE[&#039;mk_encrypt_&#039;.$pageid])) : &#039;&#039;;\n\n    if($cookiepwd == $md5pw) return;    \/\/ Cookie\u5bc6\u7801\u9a8c\u8bc1\u6b63\u786e\n\n    if($postpwd == $password) {         \/\/ \u63d0\u4ea4\u7684\u5bc6\u7801\u6b63\u786e\n        setcookie(&#039;mk_encrypt_&#039; . $pageid, $md5pw, time() + 3600000, &#039;\/&#039;);\n        return;\n    }\n?&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=UTF-8&quot;&gt; \n    &lt;meta charset=&quot;UTF-8&quot;&gt; \n    &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt; \n    &lt;meta name=&quot;renderer&quot; content=&quot;webkit&quot;&gt; \n    &lt;meta name=&quot;author&quot; content=&quot;mengkun&quot;&gt;\n    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no&quot;&gt;\n    &lt;title&gt;\u8be5\u9875\u9762\u5df2\u88ab\u52a0\u5bc6&lt;\/title&gt;\n    &lt;style type=&quot;text\/css&quot;&gt;\n    *{font-family:&quot;Microsoft Yahei&quot;,\u5fae\u8f6f\u96c5\u9ed1,&quot;Helvetica Neue&quot;,Helvetica,&quot;Hiragino Sans GB&quot;,&quot;WenQuanYi Micro Hei&quot;,sans-serif;box-sizing:border-box;margin:0px;padding:0px;font-size:14px;-webkit-transition:.2s;-moz-transition:.2s;-ms-transition:.2s;-o-transition:.2s;transition:.2s}\n    html,body{width:100%;height:100%}\n    body{background-color:#F4F6F9;color:#768093}\n    input,button{font-size:1em;border-radius:3px;-webkit-appearance:none}\n    input{width:100%;padding:5px;box-sizing:border-box;border:1px solid #e5e9ef;background-color:#f4f5f7;resize:vertical}\n    input:focus{background-color:#fff;outline:none}\n    button{border:0;background:#6abd09;color:#fff;cursor:pointer;opacity:1;user-select:none}\n    button:hover,button:focus{opacity:.9}\n    button:active{opacity:1}\n    .main{width:100%;max-width:500px;height:300px;padding:30px;background-color:#fff;border-radius:2px;box-shadow:0 10px 60px 0 rgba(29,29,31,0.09);transition:all .12s ease-out;position:absolute;left:0;top:0;bottom:0;right:0;margin:auto;text-align:center}\n    .alert{width:80px}\n    .mk-side-form{margin-bottom:28px}\n    .mk-side-form input{float:left;padding:2px 10px;width:77%;height:37px;border:1px solid #ebebeb;border-right-color:transparent;border-radius:2px 0 0 2px;line-height:37px}\n    .mk-side-form button{position:relative;overflow:visible;width:23%;height:37px;border-radius:0 2px 2px 0;text-transform:uppercase}\n    .pw-tip{font-weight:normal;font-size:26px;text-align:center;margin:25px auto}\n    #pw-error {color: red;margin-top: 15px;margin-bottom: -20px;}\n    .return-home{text-decoration:none;color:#b1b1b1;font-size:16px}\n    .return-home:hover{color:#1E9FFF;letter-spacing:5px}\n    &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;div class=&quot;main&quot;&gt;\n        &lt;svg class=&quot;alert&quot; viewBox=&quot;0 0 1084 1024&quot; xmlns=&quot;http:\/\/www.w3.org\/2000\/svg&quot; width=&quot;80&quot; height=&quot;80&quot;&gt;\n            &lt;defs&gt;&lt;style\/&gt;&lt;\/defs&gt;\n            &lt;path d=&quot;M1060.744 895.036L590.547 80.656a55.959 55.959 0 0 0-96.919 0L22.588 896.662a55.959 55.959 0 0 0 48.43 83.907h942.14a55.959 55.959 0 0 0 47.525-85.534zm-470.619-85.172a48.008 48.008 0 1 1-96.015 0v-1.567a48.008 48.008 0 1 1 96.015 0v1.567zm0-175.345a48.008 48.008 0 1 1-96.015 0V379.362a48.008 48.008 0 1 1 96.015 0v255.157z&quot; fill=&quot;#FF9800&quot;\/&gt;\n        &lt;\/svg&gt;\n\n        &lt;form action=&quot;&quot; method=&quot;post&quot; class=&quot;mk-side-form&quot;&gt;\n            &lt;h2 class=&quot;pw-tip&quot;&gt;\u8be5\u9875\u9762\u5df2\u88ab\u52a0\u5bc6&lt;\/h2&gt;\n            &lt;input type=&quot;password&quot; name=&quot;pagepwd&quot; placeholder=&quot;\u8bf7\u8f93\u5165\u8bbf\u95ee\u5bc6\u7801\u67e5\u770b&quot; required&gt;&lt;button type=&quot;submit&quot;&gt;\u63d0\u4ea4&lt;\/button&gt;\n            &lt;?php if($postpwd): ?&gt;\n            &lt;p id=&quot;pw-error&quot;&gt;Oops!\u5bc6\u7801\u4e0d\u5bf9\u54e6~&lt;\/p&gt;\n            &lt;script&gt;setTimeout(function() {document.getElementById(&quot;pw-error&quot;).style.display = &quot;none&quot;}, 2000);&lt;\/script&gt;\n            &lt;?php endif; ?&gt;\n        &lt;\/form&gt;\n        &lt;a href=&quot;\/&quot; class=&quot;return-home&quot; title=&quot;\u70b9\u51fb\u56de\u5230\u7f51\u7ad9\u9996\u9875&quot;&gt;- \u8fd4\u56de\u9996\u9875 - &lt;\/a&gt;\n    &lt;\/div&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n&lt;?php\n    exit();\n}<\/code><\/pre>\n<blockquote>\n<p>\u8f6c\u81ea:<a href=\"https:\/\/tvv.tw\/blog\/archives\/272.html\">https:\/\/tvv.tw\/blog\/archives\/272.html<\/a><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528\u65b9\u6cd5 \u628a\u4e0b\u9762\u7684\u4ee3\u7801\u5b58\u4e3aphp\u6587\u4ef6\uff0c\u4e0b\u9762\u7684\u6574\u6bb5\u4ee3\u7801\u662f\u9a8c\u8bc1\u8fc7\u7a0b\uff0c\u7136\u540e\u5728\u4f60\u5165\u53e3\u9875\u8fdb\u884c\u8c03\u7528 \u4f8b\u5982\u547d\u540d\u4e3aMkEncrypt.php\uff0c\u90a3\u4e48\u5728\u5165\u53e3\u9875 \u8fdb\u884c require_once(&#039;MkEncrypt.php&#039;); MkEncrypt(&#039;1234&#039;); \u7136\u540e\u8bbe\u7f6e\u5bc6\u7801\u4e3a MkEncrypt(&#039;1234&#039;); &lt;?phprequire_once [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[20,19],"class_list":["post-34","post","type-post","status-publish","format-standard","hentry","category-10","tag-php","tag-19"],"_links":{"self":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34"}],"version-history":[{"count":0,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=\/wp\/v2\/posts\/34\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.naspro.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}