<?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>nonozone &#187; 加密</title>
	<atom:link href="http://www.nonozone.net/tag/%e5%8a%a0%e5%af%86/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nonozone.net</link>
	<description>冷眼旁观互联网</description>
	<lastBuildDate>Mon, 16 Jan 2012 10:11:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP base64_decode+gzinflate压缩编码和解码代码</title>
		<link>http://www.nonozone.net/php-base64_decode-gzinflate-compression-encoding-and-decoding-code.html</link>
		<comments>http://www.nonozone.net/php-base64_decode-gzinflate-compression-encoding-and-decoding-code.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 04:33:06 +0000</pubDate>
		<dc:creator>nonozone</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[加密]]></category>

		<guid isPermaLink="false">http://www.nonozone.net/php-base64_decode-gzinflate-compression-encoding-and-decoding-code.html</guid>
		<description><![CDATA[刚换了一个主题，却发现页脚footer.php被加密了，里面只有下面这样一段代码： &#60;? eval(gzinflate(base64_decode(' bZC9bsMwDITnFOg7XD21g+PdVWSgS7t1CZCxkCLa EixLqqTECNCHrxX3ZwkXHu7IDyA7zh7qGpIG49B7 nymirvn93WbDGmXOq+qCDhgofySjSIr4+PSMrkR/ M0UvEkbtqhVTFRtggUNRMoMjBXlpwQR0pH5X6ZxD 2zTzPG8nMdLnyRzH7dFPFX931jjCgWQymfByMlZR ZI3gEE7dRswktU/ZuGEgGtMKWgh4W12U9dcS4Qvi LIwV0hL6SASRW+x9uIXNPswha5roB4mDjypESgn7 q124rAnLtVjq9yH/XXp1uQqdJ8tZ9w0= '))); ?&#62; 这让我咋整，我想添加一段统计代码都不知道加到哪里好，其实我也明白作者的意思，主要是不想有些人随便修改自己的版权和作者信息而已。可是我想加入自己的一些东西就比较麻烦了。怎么办？Google之。 在网上看到这样一篇文章PHP base64_decode+gzinflate压缩编码和解码代码，详细介绍了PHP base64_decode+gzinflate加密和解密的方法。 注意：解密时请不要用汉语及带空格的名字做文件名。 加密代码： &#60;?php function encode_file_contents($filename) { $type=strtolower(substr(strrchr($filename,'.'),1)); if('php'==$type &#38;&#38; is_file($filename) &#38;&#38; is_writable($filename)){// 如果是PHP文件 并且可写 则进行压缩编码 $contents = file_get_contents($filename);// 判断文件是否已经被编码处理 $pos = strpos($contents,'powered by arzn QQ:1314778'); if(false === $pos &#124;&#124; $pos&#62;100){ // 去除PHP文件注释和空白，减少文件大小 $contents = php_strip_whitespace($filename); // 去除PHP头部和尾部标识 $headerPos [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress分页插件pagebar" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-plugins-pagebar.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://static.wumii.com/site_images/2011/09/01/26857442.gif" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress分页插件pagebar</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress类facebook主题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-theme-category-facebook.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://static.wumii.com/site_images/2011/09/01/26867107.jpg" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress类facebook主题</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="SSH安装WordPress指南" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fssh-to-install-wordpress-guide.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://www.nonozone.net/wp-content/uploads/2011/09/dll-file.png" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">SSH安装WordPress指南</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress升级到2.7版本" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-update-27.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://www.nonozone.net/wp-content/uploads/2011/09/dll-file.png" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress升级到2.7版本</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress用户权限详解" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-detailed-user-permissions-2.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://static.wumii.com/site_images/2011/09/01/26857347.gif" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress用户权限详解</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>刚换了一个主题，却发现页脚footer.php被加密了，里面只有下面这样一段代码：</p>
<p><code>&lt;? eval(gzinflate(base64_decode('      <br />bZC9bsMwDITnFOg7XD21g+PdVWSgS7t1CZCxkCLa       <br />EixLqqTECNCHrxX3ZwkXHu7IDyA7zh7qGpIG49B7       <br />nymirvn93WbDGmXOq+qCDhgofySjSIr4+PSMrkR/       <br />M0UvEkbtqhVTFRtggUNRMoMjBXlpwQR0pH5X6ZxD       <br />2zTzPG8nMdLnyRzH7dFPFX931jjCgWQymfByMlZR       <br />ZI3gEE7dRswktU/ZuGEgGtMKWgh4W12U9dcS4Qvi       <br />LIwV0hL6SASRW+x9uIXNPswha5roB4mDjypESgn7       <br />q124rAnLtVjq9yH/XXp1uQqdJ8tZ9w0=       <br />'))); ?&gt;</code></p>
<p>这让我咋整，我想添加一段统计代码都不知道加到哪里好，其实我也明白作者的意思，主要是不想有些人随便修改自己的版权和作者信息而已。可是我想加入自己的一些东西就比较麻烦了。怎么办？Google之。</p>
<p>在网上看到这样一篇文章<a target="_blank" href="http://www.hebei35.cn/blog/article.asp?id=157">PHP base64_decode+gzinflate压缩编码和解码代码</a>，详细介绍了PHP base64_decode+gzinflate加密和解密的方法。</p>
<p>注意：解密时请不要用汉语及带空格的名字做文件名。</p>
<p>加密代码：</p>
<p><code>&lt;?php      <br />function encode_file_contents($filename) {       <br />$type=strtolower(substr(strrchr($filename,'.'),1));       <br />if('php'==$type &amp;&amp; is_file($filename) &amp;&amp; is_writable($filename)){// 如果是PHP文件 并且可写 则进行压缩编码       <br />$contents = file_get_contents($filename);// 判断文件是否已经被编码处理       <br />$pos = strpos($contents,'powered by arzn QQ:1314778');       <br />if(false === $pos || $pos&gt;100){ // 去除PHP文件注释和空白，减少文件大小       <br />$contents = php_strip_whitespace($filename);       <br />// 去除PHP头部和尾部标识       <br />$headerPos = strpos($contents,'&lt;?php');       <br />$footerPos = strrpos($contents,'?&gt;');       <br />$contents = substr($contents,$headerPos+5,$footerPos-$headerPos);       <br />$encode = base64_encode(gzdeflate($contents));// 开始编码       <br />$encode = '&lt;?php'.&quot;\n eval(gzinflate(base64_decode(&quot;.&quot;'&quot;.$encode.&quot;'&quot;.&quot;)));\n\n?&gt;&quot;;       <br />return file_put_contents($filename,$encode);       <br />}       <br />}       <br />return false;       <br />}       <br />//调用函数       <br />$filename='code.php';       <br />encode_file_contents($filename);       <br />echo &quot;OK,加密完成！&quot;       <br />?&gt;</code></p>
<p>解密代码：</p>
<p><code>&lt;?php&#160; <br />$Code = '这里填写要解密的编码'; // base64编码&#160; <br />$File = 'decoded.php';//解码后保存的文件&#160; <br />$Temp = base64_decode($Code);&#160; <br />$temp = gzinflate($Temp);&#160; <br />$FP = fopen($File,&quot;w&quot;);&#160; <br />fwrite($FP,$temp);&#160; <br />fclose($FP);&#160; <br />echo &quot;解密成功！&quot;;&#160; <br />?&gt;</code></p>
<p><font color="#0000ff"><strong>然后下面请注意，尤其是不懂PHP的筒子们</strong></font>！下面讲讲我这样一个没有PHP知识的人，解密那段代码的详细过程！</p>
<p>首先，打开你的文本编辑器，比如记事本，我用的是Notepad++，新建一个文本文件，按照那个解密代码，把我的那个footer.php文件里的密码输入进去，然后就类似下面：</p>
<p><code>&lt;?php      <br />$Code = '<font color="#ff0000">bZC9bsMwDITnFOg7XD21g+PdVWSgS7t1CZCxkCLa        <br />EixLqqTECNCHrxX3ZwkXHu7IDyA7zh7qGpIG49B7         <br />nymirvn93WbDGmXOq+qCDhgofySjSIr4+PSMrkR/         <br />M0UvEkbtqhVTFRtggUNRMoMjBXlpwQR0pH5X6ZxD         <br />2zTzPG8nMdLnyRzH7dFPFX931jjCgWQymfByMlZR         <br />ZI3gEE7dRswktU/ZuGEgGtMKWgh4W12U9dcS4Qvi         <br />LIwV0hL6SASRW+x9uIXNPswha5roB4mDjypESgn7         <br />q124rAnLtVjq9yH/XXp1uQqdJ8tZ9w0=</font>'; // base64编码       <br />$File = 'decoded.php';//解码后保存的文件       <br />$Temp = base64_decode($Code);       <br />$temp = gzinflate($Temp);       <br />$FP = fopen($File,&quot;w&quot;);       <br />fwrite($FP,$temp);       <br />fclose($FP);       <br />echo &quot;解密成功！&quot;;       <br />?&gt;</code></p>
<p>那段红色的部分，就是我footer.php文件里面本身的加密的代码。然后把这个文件保存，随便起个名字，但是一定要是PHP格式，我的是test.php。<font color="#0000ff">注意</font>：上面那个decoded.php就是解密完成后的文件名，这个你也可以修改。</p>
<p>然后，把这个test.php文件上传到你空间的根目录，其实其他目录也可以，但是需要能够web访问。我就直接放在博客的根目录了。</p>
<p>然后通过web访问，我的是<a href="http://www.nonozone.net/test.php">http://www.nonozone.net/test.php</a>。本来应该提示“解密成功”的，但是我没有看到，但是在服务器已经看到多了一个decoded.php文件了，打开一看，呵呵已经解密啦！！！解密后的文件是这样的！</p>
<p><code>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/div&gt;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;?php get_sidebar(); ?&gt;       <br />&#160;&#160;&#160; &lt;/div&gt;       <br />&#160;&#160;&#160; &lt;div id=&quot;footer&quot;&gt;       <br />&#160;&#160;&#160;&#160;&#160; &lt;p&gt; designed by: &lt;a href=&quot;<a href="http://www.makequick.com&quot;">http://www.makequick.com&quot;</a>&gt;Online Website Builder&lt;/a&gt; and: &lt;a href=&quot;<a href="http://www.webhostinggeeks.com&quot;">http://www.webhostinggeeks.com&quot;</a>&gt;Web Hosting &lt;/a&gt;Geeks | available free at: Top&lt;a href=&quot;<a href="http://www.topwpthemes.com&quot;">http://www.topwpthemes.com&quot;</a>&gt; WordPress Themes&lt;/a&gt;&lt;/p&gt;       <br />&#160;&#160;&#160; &lt;/div&gt;       <br />&lt;/div&gt;       <br />&lt;/body&gt;       <br />&lt;/html&gt;</code></p>
<p>怎么样，这样看就比较正常了。然后把这个decoded.php修改为footer.php替代原本的文件，就OK了！</p>
<p>好啦，就这样了。写这个文章真累！</p>
<br /><g:plusone size="" href="http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html"></g:plusone><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="WordPress分页插件pagebar" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-plugins-pagebar.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://static.wumii.com/site_images/2011/09/01/26857442.gif" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress分页插件pagebar</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress类facebook主题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-theme-category-facebook.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://static.wumii.com/site_images/2011/09/01/26867107.jpg" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress类facebook主题</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="SSH安装WordPress指南" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fssh-to-install-wordpress-guide.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://www.nonozone.net/wp-content/uploads/2011/09/dll-file.png" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">SSH安装WordPress指南</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress升级到2.7版本" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-update-27.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://www.nonozone.net/wp-content/uploads/2011/09/dll-file.png" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress升级到2.7版本</font>
                    </a>
                </td>
                <td width="108" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress用户权限详解" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.nonozone.net%2Fwordpress-detailed-user-permissions-2.html&from=http%3A%2F%2Fwww.nonozone.net%2Fphp-base64_decode-gzinflate-compression-encoding-and-decoding-code.html">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 102px !important; height: 102px !important;" src="http://static.wumii.com/site_images/2011/09/01/26857347.gif" width="102px" height="102px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 108px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress用户权限详解</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.nonozone.net/php-base64_decode-gzinflate-compression-encoding-and-decoding-code.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

