﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-peakway</title><link>http://www.cnitblog.com/peak/</link><description>奋斗不止，走向成功！</description><language>zh-cn</language><lastBuildDate>Sun, 15 Mar 2026 02:23:47 GMT</lastBuildDate><pubDate>Sun, 15 Mar 2026 02:23:47 GMT</pubDate><ttl>60</ttl><item><title>Google PageRank 和Alexa排名使用程序获取的方法</title><link>http://www.cnitblog.com/peak/archive/2005/11/10/4292.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Thu, 10 Nov 2005 08:28:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/10/4292.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/4292.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/10/4292.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/4292.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/4292.html</trackback:ping><description><![CDATA[<P>其实要得到这两个数据都不难，因为这两个工具都有Toolbar，随便找一个sniffer工具看一看就知道了。<BR>为什么要用程序得到这两个数据呢？Google Pagerank是Google排名的一个相对重要的参数，对于一批网站URL，如果能够批量地了解这些网站的PageRank，可以很快地了解这些网站的反向连接数。Alexa排名的前500名是能够列出来的，但是500名以后就没办法列出来了，如果能够通过程序得到任何域名的Alexa排名，也是相当有用的。<BR>以下是对Google PR和Alexa的一些分析及获取方法。</P>
<P>1 Google PageRank</P>
<P><A href="http://toolbarqueries.google.com/search?client=navclient-auto&amp;ch=CHECKSUM&amp;ie=UTF-8&amp;oe=UTF-8&amp;features=Rank:FVN&amp;q=info:http://YOURURL"><FONT color=#e59167>http://toolbarqueries.google.com/search?client=navclient-auto&amp;ch=CHECKSUM&amp;ie=UTF-8&amp;oe=UTF-8&amp;features=Rank:FVN&amp;q=info:http://YOURURL</FONT></A></P>
<P>以上地址中，CHECKSUM是通过对后面的<A href="http://yoururl/"><FONT color=#e59167>http://YOURURL</FONT></A>计算后得到的一个数字，用来验证URL是否从Toolbar过来的。</P>
<P>Checksum的算法请在网上搜索，一定找得到。流行最广的，也是最早的是一段PHP代码。</P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P><FONT color=#9966ff>&lt;?php <BR>/* <BR>&nbsp;&nbsp;&nbsp; This code is released unto the public domain <BR>*/ <BR>header("Content-Type: text/plain; charset=utf-8"); <BR>define('GOOGLE_MAGIC', 0xE6359A60); </FONT></P>
<P><FONT color=#9966ff>//unsigned shift right <BR>function zeroFill($a, $b) <BR>{ <BR>&nbsp;&nbsp;&nbsp; $z = hexdec(80000000); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($z &amp; $a) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a = ($a&gt;&gt;1); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a &amp;= (~$z); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a |= 0x40000000; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a = ($a&gt;&gt;($b-1)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a = ($a&gt;&gt;$b); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return $a; <BR>} </FONT></P>
<P><BR><FONT color=#9966ff>function mix($a,$b,$c) { <BR>&nbsp; $a -= $b; $a -= $c; $a ^= (zeroFill($c,13)); <BR>&nbsp; $b -= $c; $b -= $a; $b ^= ($a&lt;&lt;8); <BR>&nbsp; $c -= $a; $c -= $b; $c ^= (zeroFill($b,13)); <BR>&nbsp; $a -= $b; $a -= $c; $a ^= (zeroFill($c,12)); <BR>&nbsp; $b -= $c; $b -= $a; $b ^= ($a&lt;&lt;16); <BR>&nbsp; $c -= $a; $c -= $b; $c ^= (zeroFill($b,5)); <BR>&nbsp; $a -= $b; $a -= $c; $a ^= (zeroFill($c,3));&nbsp;&nbsp; <BR>&nbsp; $b -= $c; $b -= $a; $b ^= ($a&lt;&lt;10); <BR>&nbsp; $c -= $a; $c -= $b; $c ^= (zeroFill($b,15)); <BR>&nbsp;&nbsp; <BR>&nbsp; return array($a,$b,$c); <BR>} </FONT></P>
<P><FONT color=#9966ff>function GoogleCH($url, $length=null, $init=GOOGLE_MAGIC) { <BR>&nbsp;&nbsp;&nbsp; if(is_null($length)) { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $length = sizeof($url); <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp; $a = $b = 0x9E3779B9; <BR>&nbsp;&nbsp;&nbsp; $c = $init; <BR>&nbsp;&nbsp;&nbsp; $k = 0; <BR>&nbsp;&nbsp;&nbsp; $len = $length; <BR>&nbsp;&nbsp;&nbsp; while($len &gt;= 12) { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a += ($url[$k+0] +($url[$k+1]&lt;&lt;8) +($url[$k+2]&lt;&lt;16) +($url[$k+3]&lt;&lt;24)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $b += ($url[$k+4] +($url[$k+5]&lt;&lt;8) +($url[$k+6]&lt;&lt;16) +($url[$k+7]&lt;&lt;24)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $c += ($url[$k+8] +($url[$k+9]&lt;&lt;8) +($url[$k+10]&lt;&lt;16)+($url[$k+11]&lt;&lt;24)); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $mix = mix($a,$b,$c); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $a = $mix[0]; $b = $mix[1]; $c = $mix[2]; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $k += 12; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $len -= 12; <BR>&nbsp;&nbsp;&nbsp; } </FONT></P>
<P><FONT color=#9966ff>&nbsp;&nbsp;&nbsp; $c += $length; <BR>&nbsp;&nbsp;&nbsp; switch($len)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* all the case statements fall through */ <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 11: $c+=($url[$k+10]&lt;&lt;24); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 10: $c+=($url[$k+9]&lt;&lt;16); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 9 : $c+=($url[$k+8]&lt;&lt;8); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* the first byte of c is reserved for the length */ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 8 : $b+=($url[$k+7]&lt;&lt;24); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 7 : $b+=($url[$k+6]&lt;&lt;16); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 6 : $b+=($url[$k+5]&lt;&lt;8); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 5 : $b+=($url[$k+4]); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 4 : $a+=($url[$k+3]&lt;&lt;24); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 3 : $a+=($url[$k+2]&lt;&lt;16); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 2 : $a+=($url[$k+1]&lt;&lt;8); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case 1 : $a+=($url[$k+0]); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* case 0: nothing left to add */ <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp; $mix = mix($a,$b,$c); <BR>&nbsp;&nbsp;&nbsp; /*-------------------------------------------- report the result */ <BR>&nbsp;&nbsp;&nbsp; return $mix[2]; <BR>} </FONT></P>
<P><FONT color=#9966ff>//converts a string into an array of integers containing the numeric value of the char <BR>function strord($string) { <BR>&nbsp;&nbsp;&nbsp; for($i=0;$i&lt;strlen($string);$i++) { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $result[$i] = ord($string{$i}); <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp; return $result; <BR>} <BR>// </FONT><A href="http://www.example.com/"><FONT color=#9966ff>http://www.example.com/</FONT></A><FONT color=#9966ff> - Checksum: 6540747202 <BR>$url = 'info:'.$_GET['url']; <BR>print("</FONT><A href="http://spaces.msn.com/t{$_GET['url']}/n"><FONT color=#9966ff>url:\t{$_GET['url']}\n</FONT></A><FONT color=#9966ff>"); <BR>$ch = GoogleCH(strord($url)); <BR>printf("ch:\t6%u\n",$ch); <BR>?&gt;</FONT></P></BLOCKQUOTE>
<P><FONT color=#000000>还可以找到VB和Pascal的计算Checksum的源码。</FONT></P>
<P>GET那个URL可以直接得到那个URL的Pagerank。注意URL可以是一个域名，也可以是一个地址。这样就可以完全得到google pagerank了。</P>
<P>2 Alexa排名数据</P>
<P><A href="http://data.alexa.com/data/+wQ411en8000lA?cli=10&amp;dat=snba&amp;ver=7.0&amp;cdt=alx_vw%3D20%26wid%3D12206%26act%3D00000000000%26ss%3D1680x16t%3D0%26ttl%3D35371%26vis%3D1%26rq%3D4&amp;url=spaces.msn.com"><FONT color=#e59167>http://data.alexa.com/data/+wQ411en8000lA?cli=10&amp;dat=snba&amp;ver=7.0&amp;cdt=alx_vw%3D20%26wid%3D12206%26act%3D00000000000%26ss%3D1680x16t%3D0%26ttl%3D35371%26vis%3D1%26rq%3D4&amp;url=spaces.msn.com</FONT></A></P>
<P>GET以上地址即可。把spaces.msn.com换程序要的地址。调用后将返回一段xml如下：</P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P><FONT color=#0099cc>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</FONT></P>
<P><FONT color=#0099cc>&lt;ALEXA VER="0.9" URL="spaces.msn.com/" HOME="0" AID="="&gt;<BR>&lt;RLS TITLE="Related Links" PREFIX="http://" more ="389"&gt;<BR>&lt;RL HREF="mobile.msn.co.jp/" TYPE="link" SRC="NTrails" TITLE="Msn" CONF="034" /&gt;<BR>&lt;RL HREF="cnn.com/" TYPE="link" SRC="Siblinks" TITLE="CNN - Cable News Network" CONF="300" ASIN="B00006B48F"/&gt;<BR>&lt;RL HREF="cbsnews.com/sections/home/main100.shtml" TYPE="link" SRC="Siblinks" TITLE="CBS News" CONF="300" ASIN="B00006DFEQ"/&gt;<BR>&lt;RL HREF="abcnews.go.com/" TYPE="link" SRC="Siblinks" TITLE="ABC News" CONF="300" ASIN="B00006CBMR"/&gt;<BR>&lt;RL HREF="altavista.com/" TYPE="link" SRC="Siblinks" TITLE="Altavista" CONF="300" ASIN="B00006CZ94"/&gt;<BR>&lt;RL HREF="yahoo.com/" TYPE="link" SRC="UserEdit" TITLE="Yahoo!" CONF="300" ASIN="B00006D2TC"/&gt;<BR>&lt;RL HREF="</FONT><A href="http://www.hotbot.com/"><FONT color=#0099cc>www.hotbot.com/</FONT></A><FONT color=#0099cc>" TYPE="link" SRC="UserEdit" TITLE="HotBot" CONF="300" ASIN="B00006BUYX"/&gt;<BR>&lt;RL HREF="netscape.com/" TYPE="link" SRC="UserEdit" TITLE="Netscape" CONF="300" ASIN="B00006C6KQ"/&gt;<BR>&lt;RL HREF="excite.com/" TYPE="link" SRC="UserEdit" TITLE="My Excite" CONF="300" ASIN="B00006E21K"/&gt;<BR>&lt;RL HREF="aol.com/" TYPE="link" SRC="UserEdit" TITLE="AOL Anywhere" CONF="300" ASIN="B00006ARD3"/&gt;<BR>&lt;RL HREF="</FONT><A href="http://www.geocities.com/"><FONT color=#0099cc>www.geocities.com/</FONT></A><FONT color=#0099cc>" TYPE="link" SRC="Usertrails" TITLE="</FONT><A href="http://www.geocities.com/"><FONT color=#0099cc>www.geocities.com/</FONT></A><FONT color=#0099cc>" CONF="000"/&gt;<BR>&lt;/RLS&gt;<BR>&lt;SD TITLE="Alexa Site Data" FLAGS="DMOZ"&gt;<BR>&lt;AMZN ASIN="B000304FNA" URL="spaces.msn.com/"/&gt;<BR>&lt;ADDR STREET="One Microsoft Way" CITY="Redmond" STATE="WA" ZIP="98052" COUNTRY="US"/&gt;<BR>&lt;CREATED DATE="10-Nov-1994" DAY="10" MONTH="11" YEAR="1994"/&gt;<BR>&lt;PHONE NUMBER="unlisted"/&gt;<BR>&lt;OWNER NAME="</FONT><A href='http://www.msn.com"/'><FONT color=#0099cc>www.msn.com"/</FONT></A><FONT color=#0099cc>&gt;<BR>&lt;EMAIL ADDR="</FONT><A href='mailto:info@msn.com"/'><FONT color=#0099cc>info@msn.com"/</FONT></A><FONT color=#0099cc>&gt;<BR>&lt;POP RATE="13"/&gt;<BR>&lt;DOS&gt;<BR>&lt;DO DOMAIN="microsoft.com" TITLE="microsoft.com"/&gt;<BR>&lt;DO DOMAIN="passport.com" TITLE="passport.com"/&gt;<BR>&lt;DO DOMAIN="msnbc.com" TITLE="msnbc.com"/&gt;<BR>&lt;DO DOMAIN="windowsmedia.com" TITLE="windowsmedia.com"/&gt;<BR>&lt;DO DOMAIN="iechannelguide.com" TITLE="iechannelguide.com"/&gt;<BR>&lt;DO DOMAIN="cooltravelassistant.com" TITLE="cooltravelassistant.com"/&gt;<BR>&lt;DO DOMAIN="mstrav.com" TITLE="mstrav.com"/&gt;<BR>&lt;DO DOMAIN="msnusers.com" TITLE="msnusers.com"/&gt;<BR>&lt;DO DOMAIN="msimg.com" TITLE="msimg.com"/&gt;<BR>&lt;DO DOMAIN="eshop.com" TITLE="eshop.com"/&gt;<BR>&lt;DO DOMAIN="windowsupdate.com" TITLE="windowsupdate.com"/&gt;<BR>&lt;DO DOMAIN="passportimages.com" TITLE="passportimages.com"/&gt;<BR>&lt;DO DOMAIN="home-publishing.com" TITLE="home-publishing.com"/&gt;<BR>&lt;DO DOMAIN="slate.com" TITLE="slate.com"/&gt;<BR>&lt;DO DOMAIN="windows.com" TITLE="windows.com"/&gt;<BR>&lt;DO DOMAIN="windows95.com" TITLE="windows95.com"/&gt;<BR>&lt;DO DOMAIN="expediamaps.com" TITLE="expediamaps.com"/&gt;<BR>&lt;DO DOMAIN="encarta.com" TITLE="encarta.com"/&gt;<BR>&lt;DO DOMAIN="homeadvisor.com" TITLE="homeadvisor.com"/&gt;<BR>&lt;DO DOMAIN="carpoint.com" TITLE="carpoint.com"/&gt;<BR>&lt;DO DOMAIN="hotmai.com" TITLE="hotmai.com"/&gt;<BR>&lt;DO DOMAIN="msn.net" TITLE="msn.net"/&gt;<BR>&lt;DO DOMAIN="moneycentral.com" TITLE="moneycentral.com"/&gt;<BR>&lt;DO DOMAIN="msretech.com" TITLE="msretech.com"/&gt;<BR>&lt;DO DOMAIN="microsoftfrontpage.com" TITLE="microsoftfrontpage.com"/&gt;<BR>&lt;DO DOMAIN="vworlds.org" TITLE="vworlds.org"/&gt;<BR>&lt;DO DOMAIN="investor.com" TITLE="investor.com"/&gt;<BR>&lt;DO DOMAIN="homail.com" TITLE="homail.com"/&gt;<BR>&lt;DO DOMAIN="crimsonskies.com" TITLE="crimsonskies.com"/&gt;<BR>&lt;/DOS&gt;<BR>&lt;TICKER SYMBOL="MSFT"/&gt;<BR>&lt;LANG LEX="en"/&gt;<BR>&lt;LINKSIN NUM="5558"/&gt;<BR>&lt;SPEED TEXT="2537" PCT="30"/&gt;<BR>&lt;REVIEWS AVG="4.0" NUM="21"/&gt;<BR>&lt;POPULARITY URL="msn.com/" TEXT="2"/&gt;<BR>&lt;CHILD SRATING="0"/&gt;<BR>&lt;ASSOCS&gt;<BR>&lt;ASSOC ID="start-buymusiclink"/&gt;&lt;/ASSOCS&gt;<BR>&lt;REACH RANK="2"/&gt;<BR>&lt;/SD&gt;</FONT></P>
<P><FONT color=#0099cc>&lt;KEYWORDS&gt;<BR>&lt;/KEYWORDS&gt;<BR>&nbsp;&lt;/ALEXA&gt;<BR></FONT></P></BLOCKQUOTE>
<P dir=ltr>这样，就可以通过程序得到任何一个地址的Google PR和Alexa排名了。</P><img src ="http://www.cnitblog.com/peak/aggbug/4292.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-10 16:28 <a href="http://www.cnitblog.com/peak/archive/2005/11/10/4292.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对MD5算法的一点体会</title><link>http://www.cnitblog.com/peak/archive/2005/11/07/4058.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Mon, 07 Nov 2005 03:14:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/07/4058.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/4058.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/07/4058.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/4058.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/4058.html</trackback:ping><description><![CDATA[　　首先说我不是搞密码的，以前用MD5仅仅是写程序时处于安全考虑对口令进行加密，对于为什么MD5不能破解也不是太清楚（山大的王小云教授部分破解了MD5已经是事实），有时会看到一些软件的下载处会注明一个MD5的哈希值，开始以为是序列号之类的，但我从来没用到过这串乱码，到底为什么我希望弄清楚。<BR>　　我翻了一下资料上面说经MD5、SHA1之类的哈希算法得到的仅仅是个消息摘要，如果明文中稍作改动就会使得到的哈希产生很大的变化，不太明白也懒得看太多，于是我写了一句代码测试一下：
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&lt;?</SPAN><SPAN style="COLOR: #000000">php<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #800080">$string</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">tttttt</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">echo</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #008080">md5</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #800080">$string</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">?&gt;</SPAN></DIV><BR>当我改变string的值时，输出果然一点都不一样，我还将$string设为很长的一段文字，通过修改其中某个字符前后来判断，结果和前面一样。那么现在我产生一点想法，通过这种方法我可以判断我的文档中的文字是否被别人修改过，但是好多文档并不是普通的文本文件，比如一幅图片、一个软件，能不能用类似的办法判断是否被人修改过呢？继续测试吧，首先我读取一个二进制文件到内存中，再对读取的内容做哈希不就可以了嘛！于是用下面的代码：<BR><SPAN style="COLOR: #000000"><FONT face="Courier New"><SPAN style="COLOR: #0000bb"><SPAN style="COLOR: #000000">
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&lt;?</SPAN><SPAN style="COLOR: #000000">php<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #800080">$filename</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">c:\\test\\photo.gif</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #800080">$handle</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #008080">fopen</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #800080">$filename</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">rb</SPAN><SPAN style="COLOR: #000000">"</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #800080">$contents</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #008080">fread</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #800080">$handle</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #008080">filesize</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #800080">$filename</SPAN><SPAN style="COLOR: #000000">));<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008080">fclose</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #800080">$handle</SPAN><SPAN style="COLOR: #000000">);<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">?&gt;</SPAN></DIV>&nbsp;</SPAN></SPAN></FONT></SPAN><BR>我测试了好几种文件类型，最小的几十K，最大的600多兆，都是可行的！唯一的缺点是感觉用PHP去执行效率有点低，有这个想法我当然可以用delphi之类（其它的我还不会呢，呵呵）的工具写一个界面友好点的工具了，写到这里，才突然想到网上这种工具肯定很多，就当一个学习的过程吧！<img src ="http://www.cnitblog.com/peak/aggbug/4058.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-07 11:14 <a href="http://www.cnitblog.com/peak/archive/2005/11/07/4058.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>测试用PHP上传大文件</title><link>http://www.cnitblog.com/peak/archive/2005/11/07/4055.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Mon, 07 Nov 2005 02:29:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/07/4055.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/4055.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/07/4055.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/4055.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/4055.html</trackback:ping><description><![CDATA[这几天用PHP做一个程序，用到了大文件的上传，因为仅在局域网中使用，所以速度不是问题。我想测试一下PHP到底能传多大的文件，我修改了php.ini的几个配置，用一下程序传文件，果然可以上传几十兆甚至上百兆的文件了。<BR><BR>php.ini需要修改的量，这里仅列出原始配置，可以修改成你希望的大小
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">upload_max_filesize&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;2m&nbsp;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>post_max_size&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;2m&nbsp;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>max_execution_time&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">30</SPAN><SPAN style="COLOR: #000000">&nbsp;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>max_input_time&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">600</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>memory_limit&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;8m&nbsp;</SPAN></DIV><BR>我上传文件的代码如下：<BR><SPAN style="COLOR: #000000">------------upload.html---------------</SPAN><BR>
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">html</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">head</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">title</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">Upload&nbsp;new&nbsp;news&nbsp;file</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">title</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">head</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">h1</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">Upload&nbsp;new&nbsp;news&nbsp;file</SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">h1</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">form&nbsp;</SPAN><SPAN style="COLOR: #ff0000">enctype</SPAN><SPAN style="COLOR: #0000ff">="multipart/form-data"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;method</SPAN><SPAN style="COLOR: #0000ff">="post"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;action</SPAN><SPAN style="COLOR: #0000ff">="./upload.php"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">label</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000">upload&nbsp;this&nbsp;file:<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">input&nbsp;</SPAN><SPAN style="COLOR: #ff0000">name</SPAN><SPAN style="COLOR: #0000ff">="userfile"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;type</SPAN><SPAN style="COLOR: #0000ff">="file"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;id</SPAN><SPAN style="COLOR: #0000ff">="userfile"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">label</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">label</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">input&nbsp;</SPAN><SPAN style="COLOR: #ff0000">type</SPAN><SPAN style="COLOR: #0000ff">="submit"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;name</SPAN><SPAN style="COLOR: #0000ff">="Submit"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;value</SPAN><SPAN style="COLOR: #0000ff">="Send&nbsp;File"</SPAN><SPAN style="COLOR: #ff0000">&nbsp;</SPAN><SPAN style="COLOR: #0000ff">/&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">label</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">form</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">body</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">body</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">html</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN></DIV><FONT face=Verdana size=2>------------upload.php------------
<DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">html</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">head</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">title</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">Uploading&nbsp;</SPAN><SPAN style="COLOR: #008080">File</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/dot.gif">&lt;/</SPAN><SPAN style="COLOR: #000000">title</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">head</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">body</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;</SPAN><SPAN style="COLOR: #000000">h1</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000">Uploading&nbsp;</SPAN><SPAN style="COLOR: #008080">File</SPAN><SPAN style="COLOR: #000000"><IMG src="http://www.cnitblog.com/images/dot.gif">&lt;/</SPAN><SPAN style="COLOR: #000000">h1</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;?</SPAN><SPAN style="COLOR: #000000">php<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #008000">//</SPAN><SPAN style="COLOR: #008000">put&nbsp;the&nbsp;file&nbsp;where&nbsp;we'd&nbsp;like&nbsp;it</SPAN><SPAN style="COLOR: #008000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #800080">$upfile</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">./upload/</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">.</SPAN><SPAN style="COLOR: #800080">$_FILES</SPAN><SPAN style="COLOR: #000000">[</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">userfile</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">][</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">name</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">];<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN style="COLOR: #008080">is_uploaded_file</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #800080">$_FILES</SPAN><SPAN style="COLOR: #000000">[</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">userfile</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">][</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">tmp_name</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">]))<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>{<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">if</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #000000">!</SPAN><SPAN style="COLOR: #008080">move_uploaded_file</SPAN><SPAN style="COLOR: #000000">(</SPAN><SPAN style="COLOR: #800080">$_FILES</SPAN><SPAN style="COLOR: #000000">[</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">userfile</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">][</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">tmp_name</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">]</SPAN><SPAN style="COLOR: #000000">,</SPAN><SPAN style="COLOR: #800080">$upfile</SPAN><SPAN style="COLOR: #000000">))<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>{<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">echo</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">Problem:&nbsp;Could&nbsp;not&nbsp;move&nbsp;file&nbsp;to&nbsp;destination&nbsp;directory</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">exit</SPAN><SPAN style="COLOR: #000000">;&nbsp;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>}<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>}<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">else</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>{<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">echo</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">Problem:&nbsp;Possible&nbsp;file&nbsp;upload&nbsp;attack.&nbsp;Filename:&nbsp;</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">echo</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #800080">$_FILES</SPAN><SPAN style="COLOR: #000000">[</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">userfile</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">][</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">name</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">];<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">exit</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top>}<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #0000ff">echo</SPAN><SPAN style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">File&nbsp;upload&nbsp;successfully&lt;br&gt;&lt;br&gt;</SPAN><SPAN style="COLOR: #000000">'</SPAN><SPAN style="COLOR: #000000">;<BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">?&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">body</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align=top></SPAN><SPAN style="COLOR: #000000">&lt;/</SPAN><SPAN style="COLOR: #000000">html</SPAN><SPAN style="COLOR: #000000">&gt;</SPAN></DIV></FONT><img src ="http://www.cnitblog.com/peak/aggbug/4055.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-07 10:29 <a href="http://www.cnitblog.com/peak/archive/2005/11/07/4055.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JPG Thumbnails</title><link>http://www.cnitblog.com/peak/archive/2005/11/07/4049.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Mon, 07 Nov 2005 02:13:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/07/4049.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/4049.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/07/4049.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/4049.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/4049.html</trackback:ping><description><![CDATA[Automatically create thumbnails of JPG images to your required size. Great for creating a thumbnail of an image automatically when a user uploads a 2.5MB 3500x2500 picture and you want to have a thumbnail on the website of a specific dimension. This version only does JPGs.<BR><BR><FONT face="Courier New"><FONT color=#0000bb>&lt;?php <BR></FONT><FONT color=#007700>function&nbsp;</FONT><FONT color=#0000bb>thumbnail</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$i</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$nw</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$p</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$nn</FONT></FONT><FONT face="Courier New"><FONT color=#007700>)&nbsp;{&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$img</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb><A class=a5 href="http://php.net/imagecreatefromjpeg" target=_blank>imagecreatefromjpeg</A></FONT><FONT color=#007700>(</FONT><FONT color=#dd0000>"$i"</FONT></FONT><FONT face="Courier New"><FONT color=#007700>);&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$ow</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb><A class=a5 href="http://php.net/imagesx" target=_blank>imagesx</A></FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$img</FONT></FONT><FONT face="Courier New"><FONT color=#007700>);&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$oh</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb><A class=a5 href="http://php.net/imagesy" target=_blank>imagesy</A></FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$img</FONT></FONT><FONT face="Courier New"><FONT color=#007700>);&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$scale</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb>$nw</FONT><FONT color=#007700>/</FONT><FONT color=#0000bb>$ow</FONT></FONT><FONT face="Courier New"><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$nh</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb><A class=a5 href="http://php.net/ceil" target=_blank>ceil</A></FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$oh</FONT><FONT color=#007700>*</FONT><FONT color=#0000bb>$scale</FONT></FONT><FONT face="Courier New"><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$newimg</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb><A class=a5 href="http://php.net/imagecreate" target=_blank>imagecreate</A></FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$nw</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$nh</FONT></FONT><FONT face="Courier New"><FONT color=#007700>);&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb><A class=a5 href="http://php.net/imagecopyresized" target=_blank>imagecopyresized</A></FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$newimg</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$img</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$nw</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$nh</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$ow</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$oh</FONT></FONT><FONT face="Courier New"><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb><A class=a5 href="http://php.net/imagejpeg" target=_blank>imagejpeg</A></FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$newimg</FONT><FONT color=#007700>,&nbsp;</FONT><FONT color=#0000bb>$p</FONT><FONT color=#007700>.</FONT><FONT color=#0000bb>$nn</FONT></FONT><FONT face="Courier New"><FONT color=#007700>);&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</FONT><FONT color=#0000bb>true</FONT></FONT><FONT face="Courier New" color=#007700>;&nbsp; <BR>} <BR><BR></FONT><FONT face="Courier New"><FONT color=#ff8000>#thumbnail(filetouse,newwidth,newpath,newname); <BR></FONT><FONT color=#0000bb>thumbnail</FONT><FONT color=#007700>(</FONT><FONT color=#dd0000>"/img/x.jpg"</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>100</FONT><FONT color=#007700>,</FONT><FONT color=#dd0000>"/img/thm/"</FONT><FONT color=#007700>,</FONT><FONT color=#dd0000>"xt.jpg"</FONT></FONT><FONT face="Courier New"><FONT color=#007700>); <BR></FONT><FONT color=#0000bb>?&gt;</FONT> </FONT><img src ="http://www.cnitblog.com/peak/aggbug/4049.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-07 10:13 <a href="http://www.cnitblog.com/peak/archive/2005/11/07/4049.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Google搜索技巧2005版</title><link>http://www.cnitblog.com/peak/archive/2005/11/04/3880.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Fri, 04 Nov 2005 07:58:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/04/3880.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/3880.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/04/3880.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/3880.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/3880.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 　本文采用的是意译;本译文已经征得作者许可;本译文可任意转载，请保留本文的头信息 <br><br>注意:文中[]符号是为了突出关键词，在实际搜索中是不包含的;本文采用的是意译;本译文已经征得作者许可;本译文可任意转载，请保留本文的头信息<br>&nbsp;&nbsp;<a href='http://www.cnitblog.com/peak/archive/2005/11/04/3880.html'>阅读全文</a><img src ="http://www.cnitblog.com/peak/aggbug/3880.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-04 15:58 <a href="http://www.cnitblog.com/peak/archive/2005/11/04/3880.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个便捷申请Gmail帐号的方法</title><link>http://www.cnitblog.com/peak/archive/2005/11/04/3879.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Fri, 04 Nov 2005 07:56:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/04/3879.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/3879.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/04/3879.html#Feedback</comments><slash:comments>64</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/3879.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/3879.html</trackback:ping><description><![CDATA[<DIV class=postTitle>虽然现在获得一个Gmail已经不是什么难为的事情了，不过老是要经别人邀请才能得到，这也许会令一些相对较懒的朋友不太愉快。 <BR>    现在我们发现了一个便捷申请Gmail帐号的方法，通过一个网站，我们可以无限制地申请Gmail帐号，而无需别人的邀请。<BR>    <B>申请步骤：</B><BR><BR>    1. 登陆<A href="http://www.bytetest.com/" target=_blank s_oid="http://www.bytetest.com/" s_oidt="0">http://www.bytetest.com/</A>网站，就会看到下图的页面，如果你运气好，会在"Enter the code above to get a gmail account"这句话上面看到几个英文代码(如果看不到可以刷新几次)。<BR><BR><BR></DIV>
<DIV class=postText>
<CENTER><IMG alt="" src="http://img.skycn.com/articleimg/20050826-1.jpg"><BR>刷新后得到代码</CENTER><BR><BR>    2. 接下来你将得到的代码输入到下方"Get Gmail"前面的输入框中，然后点击"Get Gmail"。<BR><BR>    3. 到这里已经大功告成了，我们已经来到了创建 Google 帐户的页面。在这里填入你的个人资料即可成功申请Gmail了。<BR><BR>
<CENTER><IMG alt="" src="http://img.skycn.com/articleimg/20050826-2.jpg"><BR>成功申请了!</CENTER><BR><BR>    除了大容量的诱惑以外，接下来你想不想用Gmail来聊天？快去下载一个属于Google的即时聊天软件Google Talk吧！现在已经有了汉化版，可以让你轻松使用，体积只有2.17MB。<BR>[<A href="http://www.skycn.com/soft/23835.html" target=_blank>点击下载</A>]</DIV><img src ="http://www.cnitblog.com/peak/aggbug/3879.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-04 15:56 <a href="http://www.cnitblog.com/peak/archive/2005/11/04/3879.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>php 发送带附件的邮件</title><link>http://www.cnitblog.com/peak/archive/2005/11/02/3815.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Wed, 02 Nov 2005 07:35:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/02/3815.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/3815.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/02/3815.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/3815.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/3815.html</trackback:ping><description><![CDATA[作者：<span style="text-decoration: underline;">cn-linux<br></span><br>　　我经常听到这样一个问题：“我有一个从网站发来的合同。我如何给通过表单发送的电子邮件增加一个附件呢？” <br><br>　　首先我要说的是要做到这个没有什么简单的办法。你要很好的理解PHP或其它的服务器端的脚本语言。当然你还要一个真正支持PHP的网站的账号。如果满足了这个前提，在你读完了本章后就可以用PHP发送带附件的电子邮件了。 <br><br>1. 附件是如何工作的 <br><br>　　如果你曾经在PHP的手册中搜索过“附件”函数，那么结果可能是什么都没有（至少在我写本文的时间还没有）。后来你就要花很多时间来了解这方面的知识。 <br><br>　
　你也许会想当你给某个人发送一封带附件的电子邮件时，附件是和邮件一起放到收件人的信箱里的（比如，如果你给他/她发了一个PNG的图片文件，他/她的
信箱里会包含一个txt文件（电子邮件）和一个.png文件（附件）。但这不是它的工作原理。当你加入一个附件时，你的邮件程序把附件转换成纯文本文件，
并在你写的内容（实际的电子邮件）后面插入这个文本块。这个，当你把所有的东西发出来后，收件人的信箱里只有一个纯文本文件——一个同时包含附件和实际电
子邮件内容的文件。 <br><br>　　下面是一个带附件（一个HTML文件）电子邮件的例子。 <br><br>Return-Path: <br>Date: Mon, 22 May 2000 19:17:29 +0000 <br>From: Someone <br>To: Person <br>Message-id: &lt;83729KI93LI9214@example.com&gt; <br>Content-type: multipart/mixed; boundary="396d983d6b89a" <br>Subject: Here's the subject <br>--396d983d6b89a <br>Content-type: text/plain; charset=iso-8859-1 <br>Content-transfer-encoding: 8bit <br><br>This is the body of the email. <br><br>--396d983d6b89a <br>Content-type: text/html; name=attachment.html <br>Content-disposition: inline; filename=attachment.html <br>Content-transfer-encoding: 8bit <br><br><br><br><br>This is the attached HTML file <br><br><br><br>--396d983d6b89a-- <br><br><br>　
　前面的7行是邮件的头，其中值得注意的是Content-type头部分。这个头告诉邮件程序电子邮件是由一个以上的部分组成的。不含附件的邮件只有一
个部分：消息本身。带附件的电子通常至少由两部分组成：消息和附件。这样，带两个附件的邮件由三部分组成：消息，第一个附件和第二个附件。 <br><br>　　带附件的电子邮件的不同部分之间用分界线来分隔。分界线在Content--type头中定义。邮件的每个新部分以两个连字号（--）和分界线开始。 <br>最后一个分界线后也有两个连字号，表示这个邮件中没有其它的部分了。 <br><br>　　在每个分界线后有一些行，用来告诉邮件程序这个部分的内容的类型。 <br>比
如，看看上面例子中第一个分界线后面的两行--以Content-type:
text/plain开头的行。这些行说明后面的部分是ISO-8859-1字符集的纯文本。跟在第二个分界线后的行告诉邮件程序现在的部分是一个
HTML文件，它的名字是"attachment.html"。 <br><br>　　Content-disposition这持告诉邮件程序如果可
能就以内嵌的方式显示附件。现在新的邮件程序会在消息后显示HTML的内容。如果Content-
disposition被设为attachment，那么邮件程序就不会显示HTML文件的内容，而是显示一个连接到文件的图标（或其它的类似的东西）。
收件人要看附件的内容，必须点击这个图标。一般情况下，如果附件是一些文本（包含HTML），Content-disposition会被设为
inline，这是因为现在大部分邮件程序能够不借助其它浏览器而直接显示附件（文本）的内容。如果附件不是文本（比如图片或其它类似的内容），
Content-disposition 就设为attachment。 <br><br>2. 用PHP生成带附件的电子邮件 <br><br>　　这里一个例子，告诉你如果把一个定义好的HTML文件加为邮件的附件： <br><br># 我们首先写实际的消息内容 <br>$emailBody = "This is text that goes into the body of the email."; <br><br># 然后我们要作为附件的HTML文件 <br>$attachment = " <br><br>This is the attached HTML file <br><br><br>"; <br><br># 建立在邮件中分隔不同部分的分界线。 <br># 基本上，分界线可以是任意的字符串。 <br># 但是重要的一点是确定一个写邮件的人 <br># 这会随意写出的字符串，所以我们用 <br># uniqid函数来产生一个随机的字符串。 <br>$boundary = uniqid( ""); <br><br># 现在我们要建立邮件头。不要忘了插入 <br># Content-type头来说明这个邮件包含一个或更多的附件。 <br>$headers = "From: someone@example.com <br>Content-type: multipart/mixed; boundary="$boundary""; <br><br># 好，现在我们已经有了邮件的所有内容。 <br># 下一件事是修改邮件的主体。 <br>$emailBody = "--$boundary <br>Content-type: text/plain; charset=iso-8859-1 <br>Content-transfer-encoding: 8bit <br><br>$emailBody <br><br>--$boundary <br>Content-type: text/html; name=attachment.html <br>Content-disposition: inline; filename=attachment.html <br>Content-transfer-encoding: 8bit <br><br>$attachment <br><br>--$boundary--"; <br><br># 现在可以把邮件发出去了 <br>mail( "person@eksempel.dk", "The subject", $emailBody, $headers); <br>?&gt; <br><br><br>3. 把用户上传的文件作为附件 <br><br>　　你也许会觉得上面的例子难以理解，但下面...。在下面的例子中事情更难了，因为我们要用一个表单让用户上传他们的文件，并把这个文件作为我们要发的邮件的附件。麻烦的是我们不能预先知道文件的MIME类型。 <br>在
前面的例子中，我们已经知道该它是一个HTML文件，所以给这个附件设置Content-type头是很简单的。在下面的例子中，MIME类型可能是任意
的，因为用户可能会上传一个HTML文件，一个PNG文件，一个vCard文件，或者其它的东西。让我们来看看例子： <br><br># 现在我们来生成表单。在产生可以上传文件的表单时， <br># 不要忘了把 <br><br><br># 如果用户已经按了"Send"按钮" <br>if ($send) { <br># 定义分界线 <br>$boundary = uniqid( ""); <br><br># 生成邮件头 <br>$headers = "From: $from <br>Content-type: multipart/mixed; boundary="$boundary""; <br><br># 确定上传文件的MIME类型 <br>if ($attachment_type) $mimeType = $attachment_type; <br># 如果浏览器没有指定文件的MIME类型， <br># 我们可以把它设为"application/unknown". <br>else $mimeType = "application/unknown"; <br><br># 确定文件的名字 <br>$fileName = $attachment_name; <br><br># 打开文件 <br>$fp = fopen($attachment, "r"); <br># 把整个文件读入一个变量 <br>$read = fread($fp, filesize($attachment)); <br><br># 好，现在变量$read中保存的是包含整个文件内容的文本块。 <br># 现在我们要把这个文本块转换成邮件程序可以读懂的格式 <br># 我们用base64方法把它编码 <br>$read = base64_encode($read); <br><br># 现在我们有一个用base64方法编码的长字符串。 <br># 下一件事是要把这个长字符串切成由每行76个字符组成的小块 <br>$read = chunk_split($read); <br><br># 现在我们可以建立邮件的主体 <br>$body = "--$boundary <br>Content-type: text/plain; charset=iso-8859-1 <br>Content-transfer-encoding: 8bit <br><br>$body <br><br>--$boundary <br>Content-type: $mimeType; name=$fileName <br>Content-disposition: attachment; filename=$fileName <br>Content-transfer-encoding: base64 <br><br>$read <br><br>--$boundary--"; <br><br># 发送邮件 <br>mail($to, $subject, $body, $headers); <br>} <br>?&gt; <br><br>　　这就是全部内容。如果你不能很好地理解上面的例子，我的建议是给你自己发送几个带附件的邮件，然后仔细研究邮件的源代码。<img src ="http://www.cnitblog.com/peak/aggbug/3815.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-02 15:35 <a href="http://www.cnitblog.com/peak/archive/2005/11/02/3815.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>尽览云台山风光</title><link>http://www.cnitblog.com/peak/archive/2005/11/01/3788.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Tue, 01 Nov 2005 13:26:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/11/01/3788.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/3788.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/11/01/3788.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/3788.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/3788.html</trackback:ping><description><![CDATA[<div style="text-align: center;"><div style="text-align: left;">　　今天难得抽出时间到云台山一游，在身心得到放松的同时不仅为大自然的鬼斧神工而感叹不止，云台山的奇特风光、各种地质奇观和这里珍稀的濒危动物足以成为世界遗产！<br><br><div style="text-align: center;"><span style="font-weight: bold;">仙境般飞泉</span><br></div></div><br><img src="http://www.cnitblog.com/images/cnitblog_com/peak/ytsmountain/001004001005_386573_1.jpg" alt="001004001005_386573_1.jpg" border="0" height="550" width="384"> <br></div><br><div style="text-align: center;"><img src="http://www.cnitblog.com/images/cnitblog_com/peak/ytsmountain/001004001005_385962_1.jpg" alt="001004001005_385962_1.jpg" border="0" height="471" width="500"><br><br><img src="http://www.cnitblog.com/images/cnitblog_com/peak/ytsmountain/3.jpg" alt="3.jpg" border="0" height="407" width="550"><br><br><img src="http://www.cnitblog.com/images/cnitblog_com/peak/ytsmountain/4.jpg" alt="4.jpg" border="0" height="390" width="550"><br><br><img src="http://www.cnitblog.com/images/cnitblog_com/peak/ytsmountain/5.jpg" alt="5.jpg" border="0" height="390" width="550"><br><br><img src="http://www.cnitblog.com/images/cnitblog_com/peak/ytsmountain/6.jpg" alt="6.jpg" border="0" height="387" width="550"><br><br><img src="http://www.cnitblog.com/images/cnitblog_com/peak/ytsmountain/7.jpg" alt="7.jpg" border="0" height="536" width="400"><br></div><br><img src ="http://www.cnitblog.com/peak/aggbug/3788.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-11-01 21:26 <a href="http://www.cnitblog.com/peak/archive/2005/11/01/3788.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>2005岁末BLOG程序大评点</title><link>http://www.cnitblog.com/peak/archive/2005/10/31/3753.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Mon, 31 Oct 2005 13:11:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/10/31/3753.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/3753.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/10/31/3753.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/3753.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/3753.html</trackback:ping><description><![CDATA[<DIV id=content2>ASP <BR>------------------------------------------------ <BR>L-Blog: http://www.loveyuki.com <BR>由Loveyuki自主开发的基于 ASP+Access 的小型单用户BLOG，目前似乎已经停止更新了，但是用户群相当大，而且是国内相当多的BLOG系统的鼻祖。 <BR><BR>oblog: http://www.oioj.net <BR>多用户Blog,目前占据ASP多用户BLOG的大部分市场，2.X商业版已经实行免费，很值得继续关注与期待的国内作品。 <BR><BR>SLblog：http://SLblog.com <BR>多用户Blog，刚发展起来的，更新很快，感觉像是oblog和missblog的结合体，同时首创了Blog系统无限级分类和用户栏目的无限级分类，多功能在现编辑器。但界面不是很美观，好在模板和程序分离，方便修改。 <BR><BR>Misslog: http://www.misslog.com/blog <BR>多用户blog,每个blog可以有多个用户参与创作与维护，团队功能很强大！ <BR><BR>LBS: http://www.voidland.com/blog <BR>LBS早期基于L-Blog架构，自从LBS2推出以后，大部分属于自己的创作，模板很多，用户群也逐渐庞大。 <BR><BR>Z-Blog: http://www.rainbowsoft.org/zblog/ <BR>今年发展相当快的Blog系统，官方提供了想当丰富的支持，也创造了比较好的交流环境，这是他的一大亮点。 <BR><BR>PJBlog: http://www.pjhome.net/ <BR>基于ASP的单用户BLOG系统，由于其插件异常丰富，可扩展的功能很多，比较适合喜欢功能饱满的朋友。 <BR><BR>Alpar's Blog: http://blog.fz0132.com <BR>基于L-Blog架构，但是作了相当大程度的修改，全面兼容LBS^2 的Style，目前版本模板采用DIV+CSS，很值得期待后续发展。 <BR><BR>nblog: http://blog.nowans.com/ <BR>一个基于Access的个人Blog程序，全生成静态页面，刚开始起步。 <BR><BR>blogx： http://www.blanksoft.com/blogx/ <BR><BR>d2kblog: http://www.d2ksoft.com/ <BR>国外一个BLOG系统，支持多国语言页面内容和页面样式分离。 <BR><BR>KeeBlogSystem: http://keesky.com/blog/ <BR>XUL后台管理，很有特点的一个BLOG系统。 <BR><BR>ASP.NET <BR>------------------------------------------------ <BR>.Text: http://scottwater.com/Dottext/default.aspx <BR>很有名的ASP的blog系统，官方暂无静态化（对每页生成静态的html页面）版本，国内donews使用该软件。 <BR><BR>BlogX: http://www.simplegeek.com/CategoryView.aspx/BlogX <BR>程序是英国人编写的,国内 BLANKSOFT.COM 进行了汉化和修改。 <BR><BR>dasBlog: http://www.dasblog.net <BR>功能比较齐全，对FireFox的支持不怎么好。 <BR><BR><BR>PHP <BR>------------------------------------------------ <BR>Okphp BLOG: http://cn.okphp.com/ <BR>基于PHP+MYSQL开发的多用户BLOG系统，部分代码ZEND，主要特点能够很好地和许多论坛程序无缝兼容。 <BR><BR>BlogHoster: http://www.webligo.com <BR>国外的一个多用户商业BLOG系统，基于PHP+MYSQL，简洁明快的风格。 <BR><BR>exBlog: http://www.exblog.net/ <BR>基于PHP/MySQL平台开发，注重稳定效率和兼容性，使用了 PHPLIB 的模板系统，提供WAP接口。 <BR><BR>Pixelpost PhotoBlog: http://www.pixelpost.org/ <BR>国外的由图片系统和博客系统融合来的新型博客，已经由落伍的 星 完成汉化。 <BR><BR>bMachine： http://boastology.com <BR>国外老牌BLOG系统，同时支持文本数据库和MySQL数据库，支持中文搜索。 <BR><BR>7log: http://www.7log.com <BR>比较早的能够生成静态页面的BLOG系统，目前开发进度停滞。 <BR><BR><SPAN style="COLOR: red">O-blog: http://www.phpblog.cn/ <BR>需在PHP+MYSQL环境下运行，主要特色对静态生成有很大的灵活度，作者风色默默无闻地开发也让人钦佩。</SPAN> <BR><BR>pigface blog: http://www.flashforweb.com/ <BR>一个简单的BLOG,具备所有BLOG必须的功能，基于PHP＋MYSQL。 <BR><BR>bo-blog: http://www.bo-blog.com/ <BR>文本数据库，现在发展似乎遇到了瓶颈，发展不如年初那么火热，但是一样有很多追随者。 <BR><BR>C-Blog: http://www.saysay.cn <BR>由 Coolsky 自主开发的基于 PHP+Smarty模版引擎+ADODB组件 的小型单用户BLOG，目前提供2个版本:php+mysql版本 和php+access版本，能够生成静态页面。 <BR><BR>SaBlog: http://www.4ngel.net/blog/angel/ <BR>安全天使小组开发的一套BLOG系统，功能不断在完善，优点在于安全性很高。 <BR><BR>Simple PHP Blog: http://www.simplephpblog.com/ <BR>国外一个轻便的blog系统，包含中文语言文件。 <BR><BR>yo2blog: http://www.oneoo.com/ <BR>一个简单小巧快捷的 blog 程序，使用假性目录结构生成类静态 HTML 页面链接。 <BR><BR>sBLOG: http://www.sblog.cn/ <BR>国外一款基于PHP+MySQL的BLOG系统，模板遵循W3C规范，并提供mod_rewrite功能支持。 <BR><BR>b2： http://www.cafelog.com php <BR>blog的老祖宗，操作简单，容易上手，现在好像停止了开发。 <BR><BR>b2evolution: http://www.b2evolution.net <BR>B2多用户版，有很多风格和插件。 <BR><BR>wordpress： http://www.wordpress.org <BR>架站比MT简单一点，功能也很全面，应该是支持blog的首选。它有最强的模版功能，已经开始有限范围内测试多用户的新版。 <BR><BR>pivot： http://www.pivotlog.net <BR>PHP+XML，没有使用数据库，有中文语言包， <BR><BR>nucleus： http://www.nucleuscms.org <BR>这个也是比较老牌的程序了，有中文语言包！ <BR><BR>M-logger： http://miracle.shakeme.net <BR>文本储存数据。 <BR><BR>drupal： http://www.drupal.org <BR>功能强大，在多用户支持上尤为突出。它看起来更像一个内容发布系统（CMS）而不是一个纯blog软件，所以仅仅只想使用blog功能的朋友就用不着扛着这门炮了。 <BR><BR>Pmschine： http://www.pmachine.com <BR>这个估计是blog的元老了，不过现在已经商业化了，新版本名叫Expression Engine，在国内可以免费下载！ <BR><BR>bBlog： http://dev.bblog.com/ <BR>一个非常简洁好用的blog，汉化版： http://www.xptop.com/lei/ <BR><BR>serendipity： http://www.s9y.org <BR>功能很多，每个功能以模块方式安装，界面也很容易修改。 <BR><BR>Plog http://www.plogworld.org/php <BR>blog里的最好作品了，真正的多用户，不过目前官方网站打不开，不知道是不是偶的网络问题，呵呵！ <BR><BR>Plainslash： http://www.51zhao.com/plainslash/ <BR>文本blog程序，作者很久没更新了，但现在blog的基本功能都有了。 <BR><BR>CGI <BR>-------------------------------------- <BR>  <BR>movable Type： http://www.movabletype.org <BR>一个cgi程序的blog软件，应用最为广泛，大陆不算十分多，香港台湾的80%以上的独立blog站点都是通过它架设的。插件众多，基本需要的功能都能实现，它支持多用户blog。 <BR><BR>Greymatter： http://www.noahgrey.com/greysoft/ <BR>是一个类似 Movable Type 的Blog程序非常简单，也是生成静态文件。 <BR><BR>HUS Reviv： http://supermanc.51.net/norman/blog.cgi <BR>国人开发的，功能很强大，但由于cgi语言的问题，安装调试比较复杂，而且很占资源。 <BR><BR>Blosxom： http://www.blosxom.com <BR>很老的一个程序了，也可能是世界上最小的blog系统了，只有一个文件却实现了blog的大部分功能！ <BR><BR>JSP <BR>-------------------------------------- <BR>Roller：http://www.rollerweblogger.org/page/project <BR>国外运用想当广泛的一套BLOG系统。 <BR><BR>DLOG4J： http://dlog4j.sourceforge.net/ <BR>国人开发的，已经申报SourceForge项目 中文官方站： http://www.javayou.com <BR><BR>TM： http://www.terac.com <BR>一个功能强大的blog，支持文件上传、RSS、评论、WYSIWYG 编辑器等功能，多种语言（含简体中文）</DIV><img src ="http://www.cnitblog.com/peak/aggbug/3753.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-10-31 21:11 <a href="http://www.cnitblog.com/peak/archive/2005/10/31/3753.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>修正o-blog 2.5的一个bug </title><link>http://www.cnitblog.com/peak/archive/2005/10/30/3729.html</link><dc:creator>peakway</dc:creator><author>peakway</author><pubDate>Sun, 30 Oct 2005 09:03:00 GMT</pubDate><guid>http://www.cnitblog.com/peak/archive/2005/10/30/3729.html</guid><wfw:comment>http://www.cnitblog.com/peak/comments/3729.html</wfw:comment><comments>http://www.cnitblog.com/peak/archive/2005/10/30/3729.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/peak/comments/commentRss/3729.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/peak/services/trackbacks/3729.html</trackback:ping><description><![CDATA[<p>　　本人对于新技术的接触总是慢半拍，从以前的电子邮件和QQ，别人都开始用的时候我还不怎么了解，而现在也听说RSS很火，可惜我也没用过。今天一个偶然的机会，我搜索了一下RSS并下载了新浪点点通阅读器，一下被RSS新颖、使用的功能给吸引了。</p><p>　　因为我宿舍不能上网，只好单机玩。今晚我在玩我前几天下载的<strong>O-blog 2.5</strong>时，看到这个程序就有RSS功能嘛，于是我就装了新浪点点通阅读器，将<strong>O-blog</strong>假如频道，感觉不错！可是当我每次打开一篇文章时，都是打开的首页，原来是文章的链接错误，于是我看了一下xml代码（其实我也没学过xml），果然其中有个<span class="m"><font color="#0000ff"><</font></span><span class="t"><font color="#990000">link</font></span><span class="m"><font color="#0000ff">></font></span><span class="tx"><strong>http://localhost/......</strong></span><span class="m"><font color="#0000ff"></</font></span><span class="t"><font color="#990000">link</font></span><span class="m"><font color="#0000ff">></font></span> 这个地址是错误的，下面我就打开rss文件开始研究了，其实也不难嘛，我就下手改掉了错误。因为我很少写程序，所以代码写的很不规范，下面附上我的代码，请高手们指点、规范、完善以下。</p><p>1、首先在class\rss.php中加入GetExtra函数，获取静态文件扩展名，加在GetExtra()函数后即可。<br>//add some codes<br>function GetExtra()<br>{<br> global $mysql_prefix;<br> $sql = "SELECT `extraname` FROM `".$mysql_prefix."config`";<br> $result = mysql_query($sql);<br> $re = mysql_fetch_array($result);<br> return $re[0];<br>}//<br>最后一行加入<br>//add some codes<br>$extraname  = GetExtra();</p><p>2、以程序目录下rss2.php为例修改，在$a[5] = $blog[$i]['content']一行后面加入部分代码。<br>//add some codes<br>if ($blog[$i]['filename'] == "")<br>    $filename = $a[1].".".$extraname;<br>else <br>    $filename = $blog[$i]['filename'].".".$extraname;</p><p>$date_array = getdate ($blog[$i]['date']); <br>$filepath = "/archives/".$date_array['year']."/".$date_array['mon']."/".$date_array['mday']."/".$filename;<br><br>　　现在保存文件，到新浪点点通验证，success！</p><a href="http://blog.csdn.net/ipeak/archive/2005/10/30/519323.aspx"></a><img src ="http://www.cnitblog.com/peak/aggbug/3729.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/peak/" target="_blank">peakway</a> 2005-10-30 17:03 <a href="http://www.cnitblog.com/peak/archive/2005/10/30/3729.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>