{"id":157,"date":"2016-08-11T16:27:37","date_gmt":"2016-08-11T08:27:37","guid":{"rendered":"http:\/\/www.cxybj.com\/?p=157"},"modified":"2016-08-11T16:27:37","modified_gmt":"2016-08-11T08:27:37","slug":"php%e9%99%90%e5%88%b6%e8%a1%a8%e5%8d%95%e6%8f%90%e4%ba%a4%e7%9a%84%e6%ac%a1%e6%95%b0%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.cxybj.com\/?p=157","title":{"rendered":"php\u9650\u5236\u8868\u5355\u63d0\u4ea4\u7684\u6b21\u6570\u65b9\u6cd5"},"content":{"rendered":"<p><strong>\u65b9\u6cd51\uff1a\u5728php\u4e2d\u7528session\u00a0\u9650\u5236\u8868\u5355\u63d0\u4ea4\u7684\u6b21\u6570<\/strong><\/p>\n<p>define(&#8216;TIME_OUT&#8217;, 30); \/\/\u5b9a\u7fa9\u91cd\u8907\u64cd\u4f5c\u6700\u77ed\u7684\u5141\u8a31\u6642\u9593\uff0c\u55ae\u4f4d\u79d2 @session_start(); $time = time();<br \/>\nif( isset($_SESSION[&#8216;time&#8217;]) ) { if( $time &#8211; $_SESSION[&#8216;time&#8217;] &lt;= TIME_OUT ) \/\/\u5224\u65b7\u8d85\u6642 { echo &#8216;<br \/>\necho &#8220;\u6b63\u5e38&#8221;;<br \/>\n\u9019\u88cf\u548c\u4e0b\u4e00\u7bc7\u90fd\u662f\u56e0\u7232\u8981\u7528\u5230\u4e00\u500b\u77ed\u4fe1\u63a5\u53e3\uff0c\u800c\u4e14\u4e0d\u80fd\u4e00\u76f4\u9ede\u64ca\u767c\u9001\uff0c\u6240\u4ee5\u9700\u8981\u9650\u5236\uff0c\u4f46\u662fjs\u63a7\u5236\u7684\u90a3\u500b \u5982\u679c\u5237\u65b0\u6642\u9593\u5c31\u6703\u91cd\u65b0\u8a08\u7b97\uff0c\u4e5f\u5c31\u662f\u8aaa \u53ea\u8981\u4e00\u76f4\u5237\u65b0\uff0c\u7136\u5f8c\u5c31\u53ef\u4ee5\u63a5\u6536\u5230\u77ed\u4fe1\uff0c\u6240\u4ee5\u7528php\u5728\u670d\u52d9\u5668\u7aef\u9032\u884c\u9650\u5236\u5c31\u6bd4\u8f03\u5b89\u5168<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u65b9\u6cd52\uff1a\u6dfb\u52a0\u4e00\u4e2a\u8868 user_login_error<\/strong><\/p>\n<p>\u6dfb\u52a0\u4e00\u4e2a\u8868 user_login_error ,\u5b57\u6bb5 ip,time ip\u662f15\u4f4d\u5b57\u7b26\u4e32 varchar time 11\u4f4dint<br \/>\n\u5728\u767b\u5f55\u9519\u8bef\u63d0\u793a\u524d\u9762\u52a0\u5165 \u63d2\u5165\u6570\u636e\u5e93\u6570\u636e\u4ee3\u7801 \u63d2\u5165user_login_error \u8868\u4e2d ip,\u548ctime<br \/>\n\u7528\u6237\u9a8c\u8bc1\u4ee3\u7801\u7b7e\u540d\u52a0\u5165 \u67e5\u8be2\u6570\u636e\u5e93\u6570\u636e\u4ee3\u7801<br \/>\n&#8216;SELECT COUNT() FROM `user_login_error` WHERE `ip`=&#8217;.SERVER[&#8216;REMOTE_ADDR&#8217;].&#8217; and `time`&gt;&#8217;.time()-30*60;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b9\u6cd51\uff1a\u5728php\u4e2d\u7528session\u00a0\u9650\u5236\u8868\u5355\u63d0\u4ea4\u7684\u6b21\u6570 de &hellip; <a href=\"https:\/\/www.cxybj.com\/?p=157\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts\/157"}],"collection":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=157"}],"version-history":[{"count":1,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions"}],"predecessor-version":[{"id":158,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=\/wp\/v2\/posts\/157\/revisions\/158"}],"wp:attachment":[{"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cxybj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}