{"id":1691,"date":"2013-03-27T14:15:52","date_gmt":"2013-03-27T06:15:52","guid":{"rendered":"https:\/\/sdeno.com\/?p=1691"},"modified":"2013-03-27T14:25:37","modified_gmt":"2013-03-27T06:25:37","slug":"wordpress%e7%99%bb%e5%bd%95%e5%90%8e%e8%bf%94%e5%9b%9e%e5%bd%93%e5%89%8d%e9%a1%b5%e9%9d%a2","status":"publish","type":"post","link":"https:\/\/sdeno.com\/?p=1691","title":{"rendered":"wordpress\u767b\u5f55\u540e\u8fd4\u56de\u5f53\u524d\u9875\u9762"},"content":{"rendered":"<p>\u4f7f\u7528wordpress\u5f00\u653e\u6ce8\u518c\u4f1a\u5458\u529f\u80fd\u5728\u9ed8\u8ba4\u767b\u5f55\u7684\u65f6\u5019\u6ca1\u6709\u81ea\u52a8\u8fd4\u56de\u4e4b\u524d\u7684\u9875\u9762\uff0c\u8fd9\u4e2a\u5bf9\u4e8e\u975e\u7ba1\u7406\u5458\u6765\u8bf4\u7528\u6237\u4f53\u9a8c\u5f88\u5dee\uff0c\u8fd9\u91cc\u53ef\u4ee5\u8fd9\u6837\u4fee\u6539\uff1a<br \/>\n1,\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539wp-login.php\u6765\u5b9e\u73b0<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #333333; font-style: normal; line-height: 24px;\">[code]<\/span>if (!isset($_SESSION))<br \/>\n{<br \/>\nsession_start(); \/\/\u521b\u5efa\u4e00\u4e2asession\u4f1a\u8bdd<br \/>\nsession_regenerate_id();<br \/>\n}<\/p>\n<p>if (isset($_SERVER[&#8216;HTTP_REFERER&#8217;]) &amp;&amp; $_SERVER[&#8216;HTTP_REFERER&#8217;] != &#8221;<br \/>\n&amp;&amp; strpos($_SERVER[&#8216;HTTP_REFERER&#8217;],&#8217;admin&#8217;) == false<br \/>\n&amp;&amp; strpos($_SERVER[&#8216;HTTP_REFERER&#8217;],&#8217;login&#8217;) == false)<br \/>\n{<br \/>\n\/\/ \u767b\u9646\u524d\u7684\u9875\u9762\u5730\u5740<br \/>\n\/\/ \u5982\u679c\u4f60\u60f3\u767b\u9646\u540e\u8fd4\u56de\u9996\u9875\uff0c\u8bf7\u5c06 $_SERVER[&#8216;HTTP_REFERER&#8217;] \u6539\u6210 &#8216;http:\/\/\u4f60\u7684\u9996\u9875\u7f51\u5740&#8217;<br \/>\n$_SESSION[&#8220;REFERER&#8221;] = $_SERVER[&#8216;HTTP_REFERER&#8217;];<br \/>\n}<span style=\"color: #333333; font-style: normal; line-height: 24px;\">[\/code]<\/span><br \/>\n\u7136\u540e\u67e5\u627e\u4ee5\u4e0b\u4ee3\u7801\uff1a<br \/>\n[code]&lt;input type=&#8221;hidden&#8221; name=&#8221;redirect_to&#8221; value=&#8221;&lt;?php echo esc_attr($redirect_to); ?&gt;&#8221; \/&gt;[\/code]<br \/>\n\u5c06\u5176\u6539\u6210\uff1a<br \/>\n[code]&lt;input type=&#8221;hidden&#8221; name=&#8221;redirect_to&#8221; value=&#8221;&lt;?php if ( isset($_SESSION[&#8220;REFERER&#8221;]) ) { echo $_SESSION[&#8220;REFERER&#8221;]; } else { echo esc_attr($redirect_to); } ?&gt;&#8221; \/&gt;[\/code]<br \/>\n\u5982\u679c\u9700\u8981logout\u7684\u65f6\u5019\u4e5f\u8df3\u8f6c\u56de\u5f53\u524d\u9875\u9762\uff0c\u5219\u53ef\u4ee5\u67e5\u627e\uff1a<br \/>\n[code]$redirect_to = !empty( $_REQUEST[&#8216;redirect_to&#8217;] ) ? $_REQUEST[&#8216;redirect_to&#8217;] : &#8216;wp-login.php?loggedout=true&#8217;;[\/code]<br \/>\n\u5c06\u5176\u6539\u6210\uff1a<\/p>\n<p><span style=\"color: #333333; font-style: normal; line-height: 24px;\">[code]<\/span>if( !empty( $_REQUEST[&#8216;redirect_to&#8217;] ) ){<br \/>\n$redirect_to = $_REQUEST[&#8216;redirect_to&#8217;];<br \/>\n}else{<br \/>\nif ( isset($_SESSION[&#8220;REFERER&#8221;]) ) {<br \/>\n$redirect_to = $_SESSION[&#8220;REFERER&#8221;];<br \/>\n} else {<br \/>\n$redirect_to = &#8216;wp-login.php?loggedout=true&#8217;;<br \/>\n}<br \/>\n}<span style=\"color: #333333; font-style: normal; line-height: 24px;\">[\/code]<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528wordpress\u5f00\u653e\u6ce8\u518c\u4f1a\u5458\u529f\u80fd\u5728\u9ed8\u8ba4\u767b\u5f55\u7684\u65f6\u5019\u6ca1\u6709\u81ea\u52a8\u8fd4\u56de\u4e4b\u524d\u7684\u9875\u9762\uff0c\u8fd9\u4e2a\u5bf9\u4e8e\u975e\u7ba1\u7406\u5458\u6765\u8bf4\u7528\u6237\u4f53\u9a8c\u5f88\u5dee [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"close","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,11],"tags":[],"class_list":["post-1691","post","type-post","status-publish","format-standard","hentry","category-wordpress","category-11"],"_links":{"self":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/1691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1691"}],"version-history":[{"count":0,"href":"https:\/\/sdeno.com\/index.php?rest_route=\/wp\/v2\/posts\/1691\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdeno.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}