<?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>AnySQL.net &#187; 垃圾留言</title>
	<atom:link href="http://www.anysql.net/tag/%e5%9e%83%e5%9c%be%e7%95%99%e8%a8%80/feed" rel="self" type="application/rss+xml" />
	<link>http://www.anysql.net</link>
	<description>SQLULDR2, DataCopy, DataSync, WebChart, OraMon, AUL/MyDUL, 性能优化及容量分析</description>
	<lastBuildDate>Wed, 14 Jul 2010 09:27:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>对Movable Type的SCode插件的改进之二</title>
		<link>http://www.anysql.net/weblog/mt_scode_update2.html</link>
		<comments>http://www.anysql.net/weblog/mt_scode_update2.html#comments</comments>
		<pubDate>Fri, 01 Sep 2006 06:34:13 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Weblog]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[SCode]]></category>
		<category><![CDATA[垃圾留言]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e5%af%b9movable-type%e7%9a%84scode%e6%8f%92%e4%bb%b6%e7%9a%84%e6%94%b9%e8%bf%9b%e4%b9%8b%e4%ba%8c.html</guid>
		<description><![CDATA[&#160; &#160; 由于Fenng说他的站点, 就算有SCode插件也收到不少垃圾留言, 说是有些发垃圾留言的机器人可以认识到图片中的数字了. 图片验证码在很多地方都被使用, 但由于SCode默认生成的图片太有规律, 因此可能比较容易识别吧. 我在这儿主要作了两个改进: 将四个数据用不同的色彩打印出来. 在每个字符中间画一条和背景色相同的竖线,这样数字就被折成两半了 &#160; &#160; 当然我的一切修改还只是在理想化的阶段, 可惜我自已的访问量不够, 不能吸引垃圾留言. 还是来看一下我所作的修改吧. 这次只改mt-scode.cgi中的代码, 如下所示: &#160; # define the color we going to use &#160; $c_background = $im-&#62;colorAllocate(224,224,224); &#160; $c_border = $im-&#62;colorAllocate(0,0,0); &#160; $c_line = $im-&#62;colorAllocate(224,224,224); &#160; # color of first character &#160; $c_code1 = $im-&#62;colorAllocate(###,###,###); &#160; # color of second [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; 由于<a href="http://www.dbanotes.net" target="_blank">Fenng</a>说他的站点,<br />
就算有SCode插件也收到不少垃圾留言, 说是有些发垃圾留言的机器人可以认识到图片中的数字了.<br />
图片验证码在很多地方都被使用, 但由于SCode默认生成的图片太有规律, 因此可能比较容易识别吧.<br />
我在这儿主要作了两个改进:</p>
<blockquote>
<ol class="module-list">
<li class="module-list-item">将四个数据用不同的色彩打印出来.</li>
<li class="module-list-item">在每个字符中间画一条和背景色相同的竖线,这样数字就被折成两半了</li>
</ol>
</blockquote>
<p>&nbsp; &nbsp; 当然我的一切修改还只是在理想化的阶段, 可惜我自已的访问量不够, 不能吸引垃圾留言.<br />
还是来看一下我所作的修改吧. 这次只改mt-scode.cgi中的代码, 如下所示: </p>
<p><span id="more-27"></span></p>
<blockquote class="prefont"><p>
&nbsp;  # define the color we going to use<br />
&nbsp;  $c_background = $im-&gt;colorAllocate(224,224,224);<br />
&nbsp;  $c_border = $im-&gt;colorAllocate(0,0,0);<br />
&nbsp;  $c_line = $im-&gt;colorAllocate(224,224,224);</p>
<p>&nbsp;  # color of first character<br />
&nbsp;  $c_code1 = $im-&gt;colorAllocate(###,###,###); </p>
<p>&nbsp;  # color of second character<br />
&nbsp;  $c_code2 = $im-&gt;colorAllocate(###,###,###);</p>
<p>&nbsp;  # color of third character<br />
&nbsp;  $c_code3 = $im-&gt;colorAllocate(###,###,###);</p>
<p>&nbsp;  # color of forth character<br />
&nbsp;  $c_code4 = $im-&gt;colorAllocate(###,###,###);<br />
&nbsp;  <br />
&nbsp;  # Fill in the background<br />
&nbsp;  $im-&gt;fill(50,50,$c_background);<br />
&nbsp; &nbsp;  <br />
&nbsp;  # Write the code<br />
&nbsp;  $im-&gt;string(gdGiantFont,10,1,substr($scode,0,1),$c_code1);<br />
&nbsp;  $im-&gt;string(gdGiantFont,18,3,substr($scode,1,1),$c_code2);<br />
&nbsp;  $im-&gt;string(gdGiantFont,26,2,substr($scode,2,1),$c_code3);<br />
&nbsp;  $im-&gt;string(gdGiantFont,34,4,substr($scode,3,1),$c_code4);<br />
&nbsp; <br />
&nbsp;  $im-&gt;line( 5,0, 5,19,$c_line);<br />
&nbsp;  $im-&gt;line(13,0,13,19,$c_line);<br />
&nbsp;  $im-&gt;line(21,0,21,19,$c_line);<br />
&nbsp;  $im-&gt;line(29,0,29,19,$c_line);<br />
&nbsp;  $im-&gt;line(37,0,37,19,$c_line);<br />
&nbsp;  $im-&gt;line(45,0,45,19,$c_line);</p>
<p>&nbsp;  $im-&gt;rectangle(0,0,$im_length-1,19,$c_border);
</p></blockquote>
<p>&nbsp; &nbsp; 验证码图片的例了就看下面的好了. </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2006/08/31 -- <a href="http://www.anysql.net/weblog/mt_scode_update.html" title="对Movable Type插件SCode的一点改进">对Movable Type插件SCode的一点改进</a> (2)</li><li>2008/01/29 -- <a href="http://www.anysql.net/weblog/mt_scode_temp_directory.html" title="SCode的tmpdir路径">SCode的tmpdir路径</a> (0)</li><li>2008/01/29 -- <a href="http://www.anysql.net/weblog/start_to_get_spam.html" title="开始有垃圾留言了">开始有垃圾留言了</a> (3)</li><li>2008/01/21 -- <a href="http://www.anysql.net/weblog/movable_type_upgrade_336.html" title="Movable Type升级失误">Movable Type升级失误</a> (1)</li><li>2007/01/30 -- <a href="http://www.anysql.net/weblog/mt_fastcgi_scode.html" title="MT 3.34的FastCGI, 今天配置了">MT 3.34的FastCGI, 今天配置了</a> (10)</li><li>2009/06/22 -- <a href="http://www.anysql.net/weblog/movable-type-upgrade-failure.html" title="升级Movable Type失败">升级Movable Type失败</a> (2)</li><li>2009/06/03 -- <a href="http://www.anysql.net/tools/webchart-href-links.html" title="添加WebChart超文本链接">添加WebChart超文本链接</a> (3)</li><li>2009/05/14 -- <a href="http://www.anysql.net/weblog/buy_dbatools_text_links.html" title="有人要买英文站广告位">有人要买英文站广告位</a> (1)</li><li>2009/04/23 -- <a href="http://www.anysql.net/weblog/build_phpbb3_askme_pages.html" title="用phpBB3搞你问我答">用phpBB3搞你问我答</a> (1)</li><li>2008/09/10 -- <a href="http://www.anysql.net/weblog/lilina_php_505_error.html" title="DreamHost升级PHP了">DreamHost升级PHP了</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/weblog/mt_scode_update2.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>对Movable Type插件SCode的一点改进</title>
		<link>http://www.anysql.net/weblog/mt_scode_update.html</link>
		<comments>http://www.anysql.net/weblog/mt_scode_update.html#comments</comments>
		<pubDate>Fri, 01 Sep 2006 04:13:47 +0000</pubDate>
		<dc:creator>anysql</dc:creator>
				<category><![CDATA[Weblog]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[SCode]]></category>
		<category><![CDATA[垃圾留言]]></category>

		<guid isPermaLink="false">http://www.anysql.net/wordpress/uncategorized/%e5%af%b9movable-type%e6%8f%92%e4%bb%b6scode%e7%9a%84%e4%b8%80%e7%82%b9%e6%94%b9%e8%bf%9b.html</guid>
		<description><![CDATA[&#160; &#160; Fenng的站点关掉了留言的验证码(SCode插件)功能, 居说是因为这个功能占用了太多的资源, 导致了主机的负荷比较高, 不过这样之后不知道他是如何来挡垃圾留言了. 听到这个消息后, 我花了一个小时改了这么一点Perl程序, 因为我不懂Perl. 主要的改进是原来的SCode插件每次访问都要调用图形库函数, 去重新生成验证码的图片, 而我的改进之中是将这些图片保存起来, 这样的话下次访问时就直接从文件中读了, 而不会调用图形库了. &#160; &#160; 以我的网站的流量, 是看不到改进的效果的, 因此希望有人去测试一下. &#160; &#160; 对SCode.pm文件的改进, 增加了一个函数, 另外限制了生成的验证码的范围为1000-5000, 如下所示: ########################### #&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; # # Do not modify from here # #&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp; &nbsp; <a href="http://www.dbanotes.net" target="_blank">Fenng的站点</a>关掉了留言的验证码(SCode插件)功能,<br />
居说是因为这个功能占用了太多的资源, 导致了主机的负荷比较高, 不过这样之后不知道他是如何来挡垃圾留言了.<br />
听到这个消息后, 我花了一个小时改了这么一点Perl程序, 因为我不懂Perl. 主要的改进是原来的SCode插件每次访问都要调用图形库函数,<br />
去重新生成验证码的图片, 而我的改进之中是将这些图片保存起来, 这样的话下次访问时就直接从文件中读了, 而不会调用图形库了.</p>
<p>&nbsp; &nbsp; 以我的网站的流量, 是看不到改进的效果的, 因此希望有人去测试一下. </p>
<p>&nbsp; &nbsp; 对SCode.pm文件的改进, 增加了一个函数, 另外限制了生成的验证码的范围为1000-5000, 如下所示: </p>
<blockquote class="prefont"><p>
###########################<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
# Do not modify from here #<br />
#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  #<br />
###########################<br />
<font color="red"><br />
sub scode_tmpdir {<br />
&nbsp; &nbsp; return $tmpdir;<br />
}<br />
</font><br />
<br />
if ($code&gt;0 &amp;&amp; $code&lt;=$scode_maxtmp) <br />
{<br />
&nbsp; &nbsp; <font color="red">$scode = 1000 + ($scode % 4000);</font><br />
&nbsp; &nbsp; open(OUTFILE,&#8221;&gt;${tmpdir}${code}&#8221;);<br />
&nbsp; &nbsp; print OUTFILE $scode;<br />
&nbsp; &nbsp; close(OUTFILE);<br />
}
</p></blockquote>
<p>&nbsp; &nbsp; 对mt-scode.cgi的改进, 如果文件不存在就保存到文件, 否则直接从文件中读取, 主要改进如下: </p>
<p><span id="more-26"></span></p>
<blockquote class="prefont"><p>
<br />
my($MT_DIR);<br />
<font color="red">my($imgfile);</font><br />
&#8230;&#8230;<br />
# Calculate code<br />
$scode = MT::SCode::scode_get($code);<br />
<font color="red">$imgfile = MT::SCode::scode_tmpdir().&#8221;imgcache/temp&#8221;.$scode.&#8221;.png&#8221;</font>;<br />
&#8230;&#8230;<br />
<font color="red"><br />
if (-e $imgfile)<br />
{<br />
&nbsp; binmode STDOUT;<br />
&nbsp; open IMGOUT, &#8220;&lt;&#8221;.$imgfile; <br />
&nbsp; print $cgi-&gt;header(-type=&gt;&#8217;image/png&#8217;,-cookie=&gt;$cookie);<br />
&nbsp; print &lt;IMGOUT&gt;;<br />
&nbsp; close IMGOUT; <br />
}<br />
else<br />
{<br />
</font><br />
&nbsp; &#8230;&#8230;<br />
&nbsp;  # Output the image<br />
&nbsp;  binmode STDOUT;<br />
&nbsp;  print $cgi-&gt;header(-type=&gt;&#8217;image/png&#8217;);<br />
&nbsp;  print $im-&gt;png;<br />
&nbsp;  <br />
<font color="red"><br />
&nbsp;  open IMGOUT, &#8220;&gt;&#8221;.$imgfile;<br />
&nbsp;  binmode IMGOUT;<br />
&nbsp;  print $cgi-&gt;header(-type=&gt;&#8217;image/png&#8217;,-cookie=&gt;$cookie);<br />
&nbsp;  print IMGOUT $im-&gt;png;<br />
&nbsp;  close IMGOUT;<br />
}<br />
</font>
</p></blockquote>
<p>&nbsp; &nbsp; 希望我这样的改动是有用的, 有人愿意试试吗? </p>
<h3  class="related_post_title">Relative Posts:</h3><ul class="related_post"><li>2006/08/31 -- <a href="http://www.anysql.net/weblog/mt_scode_update2.html" title="对Movable Type的SCode插件的改进之二">对Movable Type的SCode插件的改进之二</a> (1)</li><li>2008/01/29 -- <a href="http://www.anysql.net/weblog/mt_scode_temp_directory.html" title="SCode的tmpdir路径">SCode的tmpdir路径</a> (0)</li><li>2008/01/29 -- <a href="http://www.anysql.net/weblog/start_to_get_spam.html" title="开始有垃圾留言了">开始有垃圾留言了</a> (3)</li><li>2008/01/21 -- <a href="http://www.anysql.net/weblog/movable_type_upgrade_336.html" title="Movable Type升级失误">Movable Type升级失误</a> (1)</li><li>2007/01/30 -- <a href="http://www.anysql.net/weblog/mt_fastcgi_scode.html" title="MT 3.34的FastCGI, 今天配置了">MT 3.34的FastCGI, 今天配置了</a> (10)</li><li>2009/06/22 -- <a href="http://www.anysql.net/weblog/movable-type-upgrade-failure.html" title="升级Movable Type失败">升级Movable Type失败</a> (2)</li><li>2009/06/03 -- <a href="http://www.anysql.net/tools/webchart-href-links.html" title="添加WebChart超文本链接">添加WebChart超文本链接</a> (3)</li><li>2009/05/14 -- <a href="http://www.anysql.net/weblog/buy_dbatools_text_links.html" title="有人要买英文站广告位">有人要买英文站广告位</a> (1)</li><li>2009/04/23 -- <a href="http://www.anysql.net/weblog/build_phpbb3_askme_pages.html" title="用phpBB3搞你问我答">用phpBB3搞你问我答</a> (1)</li><li>2008/09/10 -- <a href="http://www.anysql.net/weblog/lilina_php_505_error.html" title="DreamHost升级PHP了">DreamHost升级PHP了</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.anysql.net/weblog/mt_scode_update.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
