<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Eric&#039;s Who Know &#187; Spam</title> <atom:link href="http://who-know.com/tag/spam/feed/" rel="self" type="application/rss+xml" /><link>http://who-know.com</link> <description>C&#039;est La Vie</description> <lastBuildDate>Mon, 17 May 2010 22:21:05 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>解決 WordPress 留言不連號的問題</title><link>http://who-know.com/make-the-wordpress-comment-id-sequentially/</link> <comments>http://who-know.com/make-the-wordpress-comment-id-sequentially/#comments</comments> <pubDate>Sun, 04 Oct 2009 05:07:18 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[Free Teaching]]></category> <category><![CDATA[Spam]]></category> <category><![CDATA[Sql]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[wp-config]]></category><guid isPermaLink="false">http://who-know.com/?p=84</guid> <description><![CDATA[00. 我被嚇到了, 之前一天 2~3 篇 Spam, 感覺還可以接受, 後來用 .htaccess 把常來留垃圾留言的 IP 封了, 接下就都沒 Spam, 又覺得無聊, 就把封 IP 的設定取消。昨天心血來潮去封了 2 個 IP, 結果今天一次出現 25 則 Spam, 所以決定啟用一下先前介紹的用簡單數學題目防止垃圾留言(Math Comment Spam Protection Plugin)。
01. 之前 comment 的 id 一次都跳個 2~3 號, 算是可接受範圍, 但這次一次跳 25 號, 感覺挺不是滋味的, 所以就 Google 找答案。在眾多的搜尋結果中, 突然有溫庭筠的夢江南中提到的過盡千帆皆不是的感覺, 因為大部分都是關於解決 WordPress 文章不連號的的方法, 不過皇天不負苦心人, 終於讓我找到答案了。ALTER TABLE tablename DROP id;
ALTER [...]]]></description> <content:encoded><![CDATA[<p>00. 我被嚇到了, 之前一天 2~3 篇 Spam, 感覺還可以接受, 後來用 .htaccess 把常來留垃圾留言的 IP 封了, 接下就都沒 Spam, 又覺得無聊, 就把封 IP 的設定取消。昨天心血來潮去封了 2 個 IP, 結果今天一次出現 25 則 Spam, 所以決定啟用一下先前介紹的<a href="http://who-know.com/wordpress-plugin-math-comment-spam-protection/" target="_blank">用簡單數學題目防止垃圾留言(Math Comment Spam Protection Plugin)</a>。</p><p>01. 之前 comment 的 id 一次都跳個 2~3 號, 算是可接受範圍, 但這次一次跳 25 號, 感覺挺不是滋味的, 所以就 <a href="http://www.google.com/" target="_blank">Google</a> 找答案。在眾多的搜尋結果中, 突然有溫庭筠的夢江南中提到的過盡千帆皆不是的感覺, 因為大部分都是關於解決 WordPress 文章不連號的的方法, 不過皇天不負苦心人, 終於讓我找到答案了。<br /> <span id="more-84"></span></p><pre class="brush: sql;">ALTER TABLE tablename DROP id;
ALTER TABLE tablename ADD id INT NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST</pre><p>02. 注意事項<br /> &nbsp;&nbsp;a. 請務必先備份資料庫<br /> &nbsp;&nbsp;b. 請不要舉一反三, 想說 comment 可以變成連號, 那 post 可以嗎? 就把 wp_comments 改成 wp_posts, 然後...。因為, comment 和 post 存在著對應關係, 如果 post 的 id 修改了, 那 comment 就天下大亂了。<br /> &nbsp;&nbsp;c. 如果有使用跟 Comment 相關的插件, 那就更要備份了, 因為出問題的機率高些, 不過我使用 <a href="http://wordpress.org/extend/plugins/wp-ajax-edit-comments/" target="_blank">WP Ajax Edit Comments</a> 沒什麼問題, 但住不代表著可以不用備份喔。</p><p>03. 如果在安裝 WordPress 您沒有更改, table_prefix 為其它的值, 那可以直接使用下面的 Sql 語法, 不然要做些修正, 把出現的兩個 wp_comments, 前面的 wp_ 換成您用的 table prefix 即可。</p><p>如果您 wp-config.php 裡的 $table_prefix  = 'wp_';</p><pre class="brush: sql;">ALTER TABLE wp_comments DROP comment_ID;
ALTER TABLE wp_comments ADD comment_ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST</pre><p><a href="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/001.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/001.png" alt="" width="500" height="182" /></a></p><p><a href="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/002.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/002.png" alt=""/></a></p><p><a href="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/003.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/003.png" alt="" width="500" height="100" /></a></p><p>04. 結果</p><p>&nbsp;&nbsp;a. 原始<br /> <a href="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/004.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/004.png" alt=""  width="500" height="500"/></a><br /> &nbsp;&nbsp;b. 修改<br /> <a href="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/005.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/005.png" alt="" width="500" height="500"/></a><br /> &nbsp;&nbsp;c. 檢討: 現在已經連號, 且依 id 做排序, 不知您有沒有發現時間較早的未必拿到的是較前面的 id。<br /> <a href="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/006.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/Make_the_WordPress_Comment_ID_Sequentially/006.png" alt=""/></a></p><p>05. 如果您沒這需求, 就來欣賞一下, 溫庭筠 夢江南</p><blockquote><p>梳洗罷，獨倚望江樓。過盡千帆皆不是，斜暉脈脈水悠悠，腸斷白蘋洲。</p></blockquote><p>Ref:<br /> 01. <a href="http://blog.csdn.net/jxyuhua/archive/2005/10/15/504375.aspx" target="_blank">让MySQL自增长字段号从不连续变成连续的</a></p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/make-the-wordpress-comment-id-sequentially/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>WordPress Plugin:Math Comment Spam Protection</title><link>http://who-know.com/wordpress-plugin-math-comment-spam-protection/</link> <comments>http://who-know.com/wordpress-plugin-math-comment-spam-protection/#comments</comments> <pubDate>Mon, 31 Aug 2009 03:30:28 +0000</pubDate> <dc:creator>Eric</dc:creator> <category><![CDATA[Free Teaching]]></category> <category><![CDATA[Spam]]></category> <category><![CDATA[WordPress Plugin]]></category><guid isPermaLink="false">http://who-know.com/?p=70</guid> <description><![CDATA[一開始先到 作者網站 or WordPress Plugin 下載插件, 然後解壓縮上傳到 /wp-content/plugins 目錄，然後將下面的程式碼貼到 Theme 的 comments.php 的適當位置，像我是貼到 Website 的後面。&#60;p&#62;
&#60;?php  // Math Comment Spam Protection Plugin
if ( function_exists('math_comment_spam_protection') ) {
$mcsp_info = math_comment_spam_protection();
?&#62;
&#60;b&#62;&#60;input type=&#34;text&#34; name=&#34;mcspvalue&#34; id=&#34;mcspvalue&#34; value=&#34;&#34; size=&#34;22&#34; tabindex=&#34;4&#34; /&#62;
&#60;label for=&#34;mcspvalue&#34;&#62; Simple Math Problem : &#60;?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . [...]]]></description> <content:encoded><![CDATA[<p>一開始先到 <a href="http://sw-guide.de/wordpress/plugins/math-comment-spam-protection/" target="_blank">作者網站</a> or <a href="http://wordpress.org/extend/plugins/math-comment-spam-protection/" target="_blank">WordPress Plugin</a> 下載插件, 然後解壓縮上傳到 /wp-content/plugins 目錄，然後將下面的程式碼貼到 Theme 的 comments.php 的適當位置，像我是貼到 Website 的後面。</p><pre class="brush: php;">
&lt;p&gt;
&lt;?php  // Math Comment Spam Protection Plugin
if ( function_exists('math_comment_spam_protection') ) {
  $mcsp_info = math_comment_spam_protection();
?&gt;
&lt;b&gt;&lt;input type=&quot;text&quot; name=&quot;mcspvalue&quot; id=&quot;mcspvalue&quot; value=&quot;&quot; size=&quot;22&quot; tabindex=&quot;4&quot; /&gt;
   &lt;label for=&quot;mcspvalue&quot;&gt; Simple Math Problem : &lt;?php echo $mcsp_info['operand1'] . ' + ' . $mcsp_info['operand2'] . ' = ?' ?&gt;&lt;/label&gt;&lt;/b&gt;
   &lt;input type=&quot;hidden&quot; name=&quot;mcspinfo&quot; value=&quot;&lt;?php echo $mcsp_info['result']; ?&gt;&quot; /&gt;
&lt;?php } // if function_exists... ?&gt;
&lt;/p&gt;
</pre><p><span id="more-70"></span>上傳上去且啟用後，一定要到 Options(設定)/Math Comment Spam 裡按一下 Update Options，否則會有問題喔<br /> 數學題目的數字可以是各種形式，如果改成中文，對於防 bot 的就更有效了，這個可以在Options(設定)/Math Comment Spam 裡設定。</p><p><a href="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/001.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/001.png" alt="" width="531" height="53" /></a></p><p><a href="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/002.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/002.png" alt="" /></a></p><p><a href="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/003.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/003.png" alt="" width="531" height="53"/></a></p><p><a href="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/004.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/004.png" alt="" /></a></p><p><a href="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/005.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/005.png" alt="" width="531" height="53"/></a></p><p><a href="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/006.png" class="highslide-image" onclick="return hs.expand(this);" target="_blank"><img class="doCenter" src="http://pic.who-know.com/WP_Plugin_Math_Comment_Spam_Protection/006.png" alt="" /></a></p> ]]></content:encoded> <wfw:commentRss>http://who-know.com/wordpress-plugin-math-comment-spam-protection/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>