{"id":29874,"date":"2024-11-25T15:14:18","date_gmt":"2024-11-25T07:14:18","guid":{"rendered":"https:\/\/fwq.ai\/blog\/29874\/"},"modified":"2024-11-25T15:14:18","modified_gmt":"2024-11-25T07:14:18","slug":"%e6%b7%b1%e5%85%a5%e5%b8%9d%e5%9b%bdcms%e6%a0%b9%e6%8d%aeip%e8%b7%b3%e8%bd%ac%e5%88%b0%e4%b8%8d%e5%90%8c%e7%9a%84%e9%a1%b5%e9%9d%a2%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/29874\/","title":{"rendered":"\u6df1\u5165\u5e1d\u56fdCMS\u6839\u636eip\u8df3\u8f6c\u5230\u4e0d\u540c\u7684\u9875\u9762\u7684\u65b9\u6cd5"},"content":{"rendered":"<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/033\/5de0aba98d3b4274.gif\" class=\"aligncenter\" title=\"\u6df1\u5165\u5e1d\u56fdCMS\u6839\u636eip\u8df3\u8f6c\u5230\u4e0d\u540c\u7684\u9875\u9762\u7684\u65b9\u6cd5\u63d2\u56fe\" alt=\"\u6df1\u5165\u5e1d\u56fdCMS\u6839\u636eip\u8df3\u8f6c\u5230\u4e0d\u540c\u7684\u9875\u9762\u7684\u65b9\u6cd5\u63d2\u56fe\" \/><\/p>\n<p>\u672c\u6587\u5b9e\u4f8b\u8bb2\u8ff0\u4e86\u6839\u636eip\u8df3\u8f6c\u5230\u4e0d\u540c\u7684\u9875\u9762\u7684\u65b9\u6cd5\u3002\u5206\u4eab\u7ed9\u5927\u5bb6\u4f9b\u5927\u5bb6\u53c2\u8003\u3002<\/p>\n<p>\u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>&lt;?php \/\/php\u83b7\u53d6ip\u7684\u7b97\u6cd5\n$user_IP = ($_SERVER[\"HTTP_VIA\"]) ? $_SERVER[\"HTTP_X_FORWARDED_FOR\"] : $_SERVER[\"REMOTE_ADDR\"];\n$user_IP = ($user_IP) ? $user_IP : $_SERVER[\"REMOTE_ADDR\"];\n\/\/echo $user_IP;\n?&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63a8\u8350\u5b66\u4e60\u300a\u300b<\/p>\n<p>\u4e0a\u8ff0\u65b9\u6cd5\u83b7\u5f97\u5ba2\u6237\u7aefIP\u5730\u5740\u540e\uff0c\u518d\u4f20\u5165convertip\u51fd\u6570\u8f6c\u5316\u4e3a\u771f\u5b9e\u5730\u5740\uff0cconvertip($ip)\u51fd\u6570\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>\/\/===================================\n\/\/&nbsp;\u529f\u80fd\uff1aIP\u5730\u5740\u83b7\u53d6\u771f\u5b9e\u5730\u5740\u51fd\u6570\n\/\/&nbsp;\u53c2\u6570\uff1a$ip&nbsp;-&nbsp;IP\u5730\u5740\n\/\/===================================\nfunction&nbsp;convertip($ip)&nbsp;{\n\/\/IP\u6570\u636e\u6587\u4ef6\u8def\u5f84\n$dat_path&nbsp;=&nbsp;'QQWry.dat';\n\/\/\u68c0\u67e5IP\u5730\u5740\nif(!ereg(\"^([0-9]{1,3}.){3}[0-9]{1,3}$\",&nbsp;$ip)){\nreturn&nbsp;'IP&nbsp;Address&nbsp;Error';\n}\n\/\/\u6253\u5f00IP\u6570\u636e\u6587\u4ef6\nif(!$fd&nbsp;=&nbsp;@fopen($dat_path,&nbsp;'rb')){\nreturn&nbsp;'IP&nbsp;date&nbsp;file&nbsp;not&nbsp;exists&nbsp;or&nbsp;access&nbsp;denied';\n}\n\/\/\u5206\u89e3IP\u8fdb\u884c\u8fd0\u7b97\uff0c\u5f97\u51fa\u6574\u5f62\u6570\n$ip&nbsp;=&nbsp;explode('.',&nbsp;$ip);\n$ipNum&nbsp;=&nbsp;$ip[0]&nbsp;*&nbsp;16777216&nbsp;+&nbsp;$ip[1]&nbsp;*&nbsp;65536&nbsp;+&nbsp;$ip[2]&nbsp;*&nbsp;256&nbsp;+&nbsp;$ip[3];\n\/\/\u83b7\u53d6IP\u6570\u636e\u7d22\u5f15\u5f00\u59cb\u548c\u7ed3\u675f\u4f4d\u7f6e\n$DataBegin&nbsp;=&nbsp;fread($fd,&nbsp;4);\n$DataEnd&nbsp;=&nbsp;fread($fd,&nbsp;4);\n$ipbegin&nbsp;=&nbsp;implode('',&nbsp;unpack('L',&nbsp;$DataBegin));\nif($ipbegin&nbsp;$ipNum&nbsp;||&nbsp;$ip2num&nbsp;$ipNum)&nbsp;{\n$EndNum&nbsp;=&nbsp;$Middle;\ncontinue;\n}\n\/\/\u53d6\u5b8c\u4e0a\u4e00\u4e2a\u7d22\u5f15\u540e\u53d6\u4e0b\u4e00\u4e2a\u7d22\u5f15\n$DataSeek&nbsp;=&nbsp;fread($fd,&nbsp;3);\nif(strlen($DataSeek)&nbsp;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f7f\u7528\u65f6\u901a\u8fc7convertip\u51fd\u6570\u6839\u636eIP\u5730\u5740\u83b7\u53d6\u771f\u5b9e\u5730\u5740\uff0c\u518d\u901a\u8fc7\u5982\u4e0bjs\u4ee3\u7801\u5b9e\u73b0\u8df3\u8f6c\u529f\u80fd\uff1a<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b:<\/p>\n<pre>var&nbsp;sf='';\/\/\u6b64\u5904\u7684sf\u53d8\u91cf\u53ef\u4fdd\u5b58PHP\u51fd\u6570\u83b7\u53d6\u5230\u7684\u771f\u5b9e\u5730\u5740\nif(sf.indexOf(\"\u9999\u6e2f\")&amp;gt;=0){\nwindow.location.href=\"http:\/\/www.****.com\/?\u9999\u6e2f\";\n}\nelse&nbsp;if(sf.indexOf(\"\u5e7f\u4e1c\u7701\")&amp;gt;=0){\nwindow.location.href=\"http:\/\/www.****.com\/?\u5e7f\u4e1c\";\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5e0c\u671b\u672c\u6587\u6240\u8ff0\u5bf9\u5927\u5bb6\u7684\u5e1d\u56fdCMS\u5efa\u7ad9\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6df1\u5165\u5e1d\u56fdCMS\u6839\u636eip\u8df3\u8f6c\u5230\u4e0d\u540c\u7684\u9875\u9762\u7684\u65b9\u6cd5\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u5b9e\u4f8b\u8bb2\u8ff0\u4e86\u6839\u636eip\u8df3\u8f6c\u5230\u4e0d\u540c\u7684\u9875\u9762\u7684\u65b9\u6cd5\u3002\u5206\u4eab\u7ed9\u5927\u5bb6\u4f9b\u5927\u5bb6\u53c2\u8003\u3002 \u5177\u4f53\u5b9e\u73b0\u4ee3\u7801\u5982\u4e0b\uff1a \u4ee3\u7801\u5982\u4e0b: &lt;?php \/\/php\u83b7\u53d6ip\u7684\u7b97\u6cd5 $user_IP = ($_SERVER[&#8220;HTTP_VIA&#8221;]) ? $_SERVER[&#8220;HTTP_X_FORWARDED_FOR&#8221;] : $_SERVER[&#8220;REMOTE_ADDR&#8221;]; $user_IP = ($user_IP) ? $user_IP : $_SERVER[&#8220;REMOTE_ADDR&#8221;]; \/\/echo $user_IP; ?&gt; \u767b\u5f55\u540e\u590d\u5236 \u63a8\u8350\u5b66\u4e60\u300a\u300b \u4e0a\u8ff0\u65b9\u6cd5\u83b7\u5f97\u5ba2\u6237\u7aefIP\u5730\u5740\u540e\uff0c\u518d\u4f20\u5165convertip\u51fd\u6570\u8f6c\u5316\u4e3a\u771f\u5b9e\u5730\u5740\uff0cconvertip($ip)\u51fd\u6570\u4ee3\u7801\u5982\u4e0b\uff1a \u4ee3\u7801\u5982\u4e0b: \/\/=================================== \/\/&nbsp;\u529f\u80fd\uff1aIP\u5730\u5740\u83b7\u53d6\u771f\u5b9e\u5730\u5740\u51fd\u6570 \/\/&nbsp;\u53c2\u6570\uff1a$ip&nbsp;&#8211;&nbsp;IP\u5730\u5740 \/\/=================================== function&nbsp;convertip($ip)&nbsp;{ \/\/IP\u6570\u636e\u6587\u4ef6\u8def\u5f84 $dat_path&nbsp;=&nbsp;&#8216;QQWry.dat&#8217;; \/\/\u68c0\u67e5IP\u5730\u5740 if(!ereg(&#8220;^([0-9]{1,3}.){3}[0-9]{1,3}$&#8221;,&nbsp;$ip)){ return&nbsp;&#8216;IP&nbsp;Address&nbsp;Error&#8217;; } \/\/\u6253\u5f00IP\u6570\u636e\u6587\u4ef6 if(!$fd&nbsp;=&nbsp;@fopen($dat_path,&nbsp;&#8216;rb&#8217;)){ return&nbsp;&#8216;IP&nbsp;date&nbsp;file&nbsp;not&nbsp;exists&nbsp;or&nbsp;access&nbsp;denied&#8217;; } \/\/\u5206\u89e3IP\u8fdb\u884c\u8fd0\u7b97\uff0c\u5f97\u51fa\u6574\u5f62\u6570 $ip&nbsp;=&nbsp;explode(&#8216;.&#8217;,&nbsp;$ip); $ipNum&nbsp;=&nbsp;$ip[0]&nbsp;*&nbsp;16777216&nbsp;+&nbsp;$ip[1]&nbsp;*&nbsp;65536&nbsp;+&nbsp;$ip[2]&nbsp;*&nbsp;256&nbsp;+&nbsp;$ip[3]; \/\/\u83b7\u53d6IP\u6570\u636e\u7d22\u5f15\u5f00\u59cb\u548c\u7ed3\u675f\u4f4d\u7f6e $DataBegin&nbsp;=&nbsp;fread($fd,&nbsp;4); $DataEnd&nbsp;=&nbsp;fread($fd,&nbsp;4); $ipbegin&nbsp;=&nbsp;implode(&#8221;,&nbsp;unpack(&#8216;L&#8217;,&nbsp;$DataBegin)); if($ipbegin&nbsp;$ipNum&nbsp;||&nbsp;$ip2num&nbsp;$ipNum)&nbsp;{ $EndNum&nbsp;=&nbsp;$Middle; continue; } \/\/\u53d6\u5b8c\u4e0a\u4e00\u4e2a\u7d22\u5f15\u540e\u53d6\u4e0b\u4e00\u4e2a\u7d22\u5f15 $DataSeek&nbsp;=&nbsp;fread($fd,&nbsp;3); if(strlen($DataSeek)&nbsp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-29874","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29874","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=29874"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/29874\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=29874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=29874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=29874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}