<?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>Guan Gui</title>
	<atom:link href="http://www.guiguan.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guiguan.net</link>
	<description>The World of Guan</description>
	<lastBuildDate>Fri, 18 May 2012 04:42:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>让使用Permalink的WordPress 3.3.2也支持中文搜索</title>
		<link>http://www.guiguan.net/%e8%ae%a9%e4%bd%bf%e7%94%a8permalink%e7%9a%84wordpress-3-3-2%e4%b9%9f%e6%94%af%e6%8c%81%e4%b8%ad%e6%96%87%e6%90%9c%e7%b4%a2/</link>
		<comments>http://www.guiguan.net/%e8%ae%a9%e4%bd%bf%e7%94%a8permalink%e7%9a%84wordpress-3-3-2%e4%b9%9f%e6%94%af%e6%8c%81%e4%b8%ad%e6%96%87%e6%90%9c%e7%b4%a2/#comments</comments>
		<pubDate>Thu, 17 May 2012 14:01:16 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[Bug & Solution]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[search permalink]]></category>
		<category><![CDATA[special character]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[中文搜索]]></category>

		<guid isPermaLink="false">http://www.guiguan.net/?p=319</guid>
		<description><![CDATA[在Wordpress 3.3.2中，如果设置了Permalink (not selecting default in Settings-&#62;Permalinks-&#62;Common Settings)，当用户搜索的时候，原本index.php?s=THINGS_YOU_WANT_TO_SEARCH的GET请求形式（如Figure 1）会变成search/THINGS_YOU_WANT_TO_SEARCH（如Figure 2)。这样能够使URL变得更加富含语意(semantic)。但是，当THINGS_YOU_WANT_TO_SEARCH中包含特殊字符，如#, ?，或者其他语言，如中文，的时候，问题就来了：使用前面非Permalink的搜索GET请求可以正常搜索，而使用后面Permalink形式的搜索GET请求则不能够进行搜索，WordPress 3.3.2会提示“找不到”或者会去掉非标准URL字符进行搜索，而得出错误的搜索结果。 这肯定是Wordpress  3.3.2内部在decode URL请求不一致造成的。我在网上找了一下，没发现什么方法能够很好的解决这个问题。我估计中文版的Wordpress也许根本就不存在这个问题。 目前，在不修改Wordpress 3.3.2源代码的情况下解决这个问题的最佳方法应该就是通过Apache的mod_rewrite了吧。以下是我的解决方案： 在WP根目录下打开或者创建一个.htaccess文件，并添加以下内容： 注意，其中的RewriteBase应该是你WP相对于根目录的路径，如/wordpress/，我的WP安装在更目录的，所有是/。 虽然现在还没发现这个解决方法的bug，这只是一个临时的方法(所以我才用302, Moved temporarily)，为了让Wordpress 3.3.2能够方便地在未来进行升级。Permalink是很诱人的，希望WP在未来版本中能够很好地解决这个问题。]]></description>
			<content:encoded><![CDATA[
		<dl id="attachment_326" class="wp-caption alignnone" style="width:452px">
			<dt><a href="http://www.guiguan.net/storage/2012/05/Safari11.png"><img class="size-full wp-image-326  colorbox-319" title="Wordpress 3.3.2 Search Request URL with Permalink (The Bug)" src="http://www.guiguan.net/storage/2012/05/Safari11.png" alt="Wordpress 3.3.2 Search Request URL with Permalink (The Bug)" width="452" height="183" /></a></dt>
			<dd>Figure 1: Search Request URL with Permalink (The Bug)</dd>
		</dl>

		<dl id="attachment_325" class="wp-caption alignnone" style="width:453px">
			<dt><a href="http://www.guiguan.net/storage/2012/05/Safari1.png"><img class="size-full wp-image-325 colorbox-319" title="Wordpress 3.3.2 Search Request URL without Permalink" src="http://www.guiguan.net/storage/2012/05/Safari1.png" alt="Wordpress 3.3.2 Search Request URL without Permalink" width="453" height="242" /></a></dt>
			<dd>Figure 2: Search Request URL without Permalink</dd>
		</dl>
<p>在Wordpress 3.3.2中，如果设置了Permalink (not selecting default in Settings-&gt;Permalinks-&gt;Common Settings)，当用户搜索的时候，原本<strong>index.php?s=THINGS_YOU_WANT_TO_SEARCH</strong>的GET请求形式（如Figure 1）会变成<strong>search/THINGS_YOU_WANT_TO_SEARCH</strong>（如Figure 2)。这样能够使URL变得更加富含语意(semantic)。但是，当<strong>THINGS_YOU_WANT_TO_SEARCH</strong>中包含特殊字符，如#, ?，或者其他语言，如中文，的时候，问题就来了：使用前面非Permalink的搜索GET请求可以正常搜索，而使用后面Permalink形式的搜索GET请求则不能够进行搜索，<span id="more-319"></span>WordPress 3.3.2会提示“找不到”或者会去掉非标准URL字符进行搜索，而得出错误的搜索结果。</p>
<p>这肯定是Wordpress  3.3.2内部在decode URL请求不一致造成的。我在网上找了一下，没发现什么方法能够很好的解决这个问题。我估计中文版的Wordpress也许根本就不存在这个问题。</p>
<p>目前，在不修改Wordpress 3.3.2源代码的情况下解决这个问题的最佳方法应该就是通过Apache的mod_rewrite了吧。以下是我的解决方案：</p>
<p>在WP根目录下打开或者创建一个.htaccess文件，并添加以下内容：</p>
<pre class="brush: plain; title: ; notranslate">

RewriteEngine on
RewriteBase /
RewriteRule ^search/(.*)$ /?s=$1 [L,R=302]
</pre>
<p>注意，其中的RewriteBase应该是你WP相对于根目录的路径，如/wordpress/，我的WP安装在更目录的，所有是/。<br />
虽然现在还没发现这个解决方法的bug，这只是一个临时的方法(所以我才用302, Moved temporarily)，为了让Wordpress 3.3.2能够方便地在未来进行升级。Permalink是很诱人的，希望WP在未来版本中能够很好地解决这个问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/%e8%ae%a9%e4%bd%bf%e7%94%a8permalink%e7%9a%84wordpress-3-3-2%e4%b9%9f%e6%94%af%e6%8c%81%e4%b8%ad%e6%96%87%e6%90%9c%e7%b4%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alfred Extension: Skype-Call 1.0</title>
		<link>http://www.guiguan.net/alfred-extension-skype-call-1-0/</link>
		<comments>http://www.guiguan.net/alfred-extension-skype-call-1-0/#comments</comments>
		<pubDate>Thu, 17 May 2012 04:32:51 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[Alfred]]></category>

		<guid isPermaLink="false">http://www.guiguan.net/?p=308</guid>
		<description><![CDATA[An Alfred extension to make Skype phone call to the phone number selected by Alfred&#8217;s Address Book feature. If the Skype hasn&#8217;t been opened yet, this extension will open it and ensure it is online before starting the phone call. When making a phone call, this extension won&#8217;t change your Skype online status, and no&#8230;]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.guiguan.net/storage/2012/05/Search-for-A-Contact.png"><img class="alignnone size-medium wp-image-310 colorbox-308" title="Search-for-A-Contact" src="http://www.guiguan.net/storage/2012/05/Search-for-A-Contact-300x78.png" alt="" width="300" height="78" /></a></p>
<p><a href="http://www.guiguan.net/storage/2012/05/Select-A-Phone-Number.png"><img class="size-medium wp-image-309 aligncenter colorbox-308" title="Select-A-Phone-Number" src="http://www.guiguan.net/storage/2012/05/Select-A-Phone-Number-300x118.png" alt="" width="300" height="118" /></a></p>
<p>An <a href="http://www.alfredapp.com">Alfred</a> extension to make Skype phone call to the phone number selected by Alfred&#8217;s Address Book feature. If the Skype hasn&#8217;t been opened yet, this extension will open it and ensure it is online before starting the phone call. When making a phone call, this extension won&#8217;t change your Skype online status, and no annoying confirmation dialog box will be popped up.</p>
<p>The alternative url scheme <em>skype:{query}?call</em> approach is not able make a phone call when Skype hasn&#8217;t been opened in some system environment, such as Mac OS X 10.8 Developer Preview 3, and the alternative approach will cause the annoying confirmation dialog to be popped up every time when you try to make a phone call.</p>
<p>This extension is compatible with David Ferguson&#8217;s <a href="http://jdfwarrior.tumblr.com/post/13826478125/extension-updater">Extension Updater for Alfred</a>, and it has been tested on Skype 5.7.0.1037 and Alfred 1.2 (220).</p>
<p>For details and how to download and install, please visit my project page on github: <a href="http://guiguan.github.com/Skype-Call/">http://guiguan.github.com/Skype-Call/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/alfred-extension-skype-call-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quartz-like Crystals Found in Planetary Quartz-like crystals found in planetary disks</title>
		<link>http://www.guiguan.net/quartz-like-crystals-found-in-planetary-quartz-like-crystals-found-in-planetary-disks/</link>
		<comments>http://www.guiguan.net/quartz-like-crystals-found-in-planetary-quartz-like-crystals-found-in-planetary-disks/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 02:36:18 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[Astronomy]]></category>

		<guid isPermaLink="false">http://blog.guiguan.net/?p=150</guid>
		<description><![CDATA[NASA&#8217;s Spitzer Space Telescope has, for the first time, detected tiny quartz-like crystals sprinkled in young planetary systems. The crystals, which are types of silica minerals called cristobalite and tridymite, can be seen close-up in the black-and-white insets (cristobalite is on the left, and tridymite on the right). The main picture is an artist&#8217;s concept&#8230;]]></description>
			<content:encoded><![CDATA[<div class="mceTemp mceIEcenter">
<p><a href="http://www.guiguan.net/storage/2012/05/248689.jpg"><img class="size-medium wp-image-246 alignleft colorbox-150" title="Quartz-like Crystals Found in Planetary Quartz-like crystals found in planetary disks" src="http://www.guiguan.net/storage/2012/05/248689-300x240.jpg" alt="" width="300" height="240" /></a></p>
<p style="text-align: left;">NASA&#8217;s Spitzer Space Telescope has, for the first time, detected tiny quartz-like crystals sprinkled in young planetary systems. The crystals, which are types of silica minerals called cristobalite and tridymite, can be seen close-up in the black-and-white insets (cristobalite is on the left, and tridymite on the right). The main picture is an artist&#8217;s concept of a young star and its swirling disk of planet-forming materials.</p>
<p style="text-align: right;">Courtesy NASA/JPL-Caltech</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/quartz-like-crystals-found-in-planetary-quartz-like-crystals-found-in-planetary-disks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A small but very hard to find bug</title>
		<link>http://www.guiguan.net/a-small-but-very-hard-to-find-bug/</link>
		<comments>http://www.guiguan.net/a-small-but-very-hard-to-find-bug/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 14:31:55 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Problem Solving]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[Hearts]]></category>

		<guid isPermaLink="false">http://blog.guiguan.net/?p=135</guid>
		<description><![CDATA[Bug is a very disgusting thing in Computer Science. In one of my subjects project, I was required to write a Hearts card game robot player. I spent several hours finished the code, but it took me 2 days to debug it. . A tiny bug found in the debugging process took me a whole&#8230;]]></description>
			<content:encoded><![CDATA[<p>Bug is a very disgusting thing in Computer Science. In one of my subjects project, I was required to write a Hearts card game robot player. I spent several hours finished the code, but it took me 2 days to debug it. <img src='http://www.guiguan.net/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley colorbox-135' /> . A tiny bug found in the debugging process took me a whole night, which resulted to be mistyping variable Card as C, very embarrassed!</p>
<p>The funniest thing was that in order to find that tiny bug, I used a screen recording software recorded the whole playing process, then simulated the whole process by re-watching the recorded video again and again, but finally came to the conclusion that there was no bug in my program! I was nearly desperate, fortunately, an accidental warning msg &#8220;singleton variable&#8221; saved my life.</p>
<p>Here is the video I recorded:</p>
<p><span style="text-decoration: underline;"><a href="http://blog.guiguan.net/storage/2008/09/void.html" target="_blank"><img class="alignnone size-medium wp-image-139 colorbox-135" title="screen-movie-poster" src="http://blog.guiguan.net/storage/2008/09/screen-movie-poster-300x196.jpg" alt="" width="300" height="196" /></a></span></p>
<p>after playing for awhile, my robot(bottom one) stopped play.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/a-small-but-very-hard-to-find-bug/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Will cities of the future look like Beijing, pictured here?</title>
		<link>http://www.guiguan.net/will-cities-of-the-future-look-like-beijing-pictured-here/</link>
		<comments>http://www.guiguan.net/will-cities-of-the-future-look-like-beijing-pictured-here/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 12:16:12 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://blog.guiguan.net/?p=133</guid>
		<description><![CDATA[Cities are an important testing ground for green technologies because urbanization is accelerating rapidly. More than half of the world&#8217;s population now lives in cities&#8211;and most population growth in coming decades will happen there, mostly in developing countries. Will cities of the future look like Beijing, pictured here? read all texts about Cities go green]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.guiguan.net/storage/2008/06/idfchina_550x399.jpg"><img class="alignnone size-medium wp-image-134 colorbox-133" title="idfchina_550x399" src="http://blog.guiguan.net/storage/2008/06/idfchina_550x399-300x217.jpg" alt="" width="300" height="217" /></a></p>
<p>Cities are an important testing ground for green technologies because urbanization is accelerating rapidly. More than half of the world&#8217;s population now lives in cities&#8211;and most population growth in coming decades will happen there, mostly in developing countries.</p>
<p>Will cities of the future look like Beijing, pictured here?</p>
<p><a href="http://news.cnet.com/2300-13836_3-6241392-1.html?tag=ne.gall.pg">read all texts about Cities go green</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/will-cities-of-the-future-look-like-beijing-pictured-here/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>eclipse CDT + mingw + gtk + cairo under Windows XP</title>
		<link>http://www.guiguan.net/eclipse-cdt-mingw-gtk-cairo-under-windows-xp/</link>
		<comments>http://www.guiguan.net/eclipse-cdt-mingw-gtk-cairo-under-windows-xp/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 16:25:14 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://blog.guiguan.net/?p=129</guid>
		<description><![CDATA[Finally, I managed to compile a gtk + cairo GUI program by using mingw GNU make and eclipse CDT under Windows XP.]]></description>
			<content:encoded><![CDATA[<p>Finally, I managed to compile a gtk + cairo GUI program by using mingw GNU make and eclipse CDT under Windows XP.</p>
<p><a href="http://blog.guiguan.net/storage/2008/06/snap1.png"><img class="aligncenter size-medium wp-image-132 colorbox-129" title="eclipse CDT + mingw + gtk + cairo" src="http://blog.guiguan.net/storage/2008/06/snap1-300x231.png" alt="eclipse CDT + mingw + gtk + cairo" width="300" height="231" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/eclipse-cdt-mingw-gtk-cairo-under-windows-xp/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Map: What Does the Internet Look Like?</title>
		<link>http://www.guiguan.net/map-what-does-the-internet-look-like/</link>
		<comments>http://www.guiguan.net/map-what-does-the-internet-look-like/#comments</comments>
		<pubDate>Sun, 02 Mar 2008 12:52:11 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[Network]]></category>

		<guid isPermaLink="false">http://www.guiguan.net/2008/03/map-what-does-the-internet-look-like/</guid>
		<description><![CDATA[read more]]></description>
			<content:encoded><![CDATA[<p><a href="/storage/2008/03/internet750.jpg" target="_blank"><img class="colorbox-126"  src="/storage/2008/03/internet750.jpg" alt="internet750.jpg" height="384" width="420" /></a></p>
<p><a href="http://discovermagazine.com/2006/oct/map-internet-servers/" target="_blank">read more</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/map-what-does-the-internet-look-like/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Emacs入门指南</title>
		<link>http://www.guiguan.net/emacs%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97/</link>
		<comments>http://www.guiguan.net/emacs%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 13:39:25 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.guiguan.net/2008/02/emacs%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97/</guid>
		<description><![CDATA[Emacs入门指南(1) Emacs入门指南(2) Emacs入门指南(3)]]></description>
			<content:encoded><![CDATA[<p><a href="http://dev.csdn.net/article/46/article/29/29642.shtm"><strong><span id="ArticleTitle1_ArticleTitle1_lblTitle">Emacs入门指南(1)</span></strong></a></p>
<p><a href="http://dev.csdn.net/article/29/29643.shtm"><strong><span id="ArticleTitle1_ArticleTitle1_lblTitle">Emacs入门指南(2)</span></strong> </a></p>
<p><a href="http://dev.csdn.net/article/29/29680.shtm"><strong><span id="ArticleTitle1_ArticleTitle1_lblTitle">Emacs入门指南(3)</span></strong> </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/emacs%e5%85%a5%e9%97%a8%e6%8c%87%e5%8d%97/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LDBL_MAX -1.#QNAN0e+000 with MinGW?</title>
		<link>http://www.guiguan.net/ldbl_max-1qnan0e000-with-mingw/</link>
		<comments>http://www.guiguan.net/ldbl_max-1qnan0e000-with-mingw/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 05:14:19 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[C]]></category>

		<guid isPermaLink="false">http://www.guiguan.net/2007/11/ldbl_max-1qnan0e000-with-mingw/</guid>
		<description><![CDATA[I have tried to run this with both eclipse(CDT)+MinGW and Cygwin+GCC but got different results: In eclipse(CDT)+MinGW The range of long double is [-1.#QNAN0e+000, 3.237810e-319]∪[6.953674e-310, 0.000000e+000] In Cygwin+GCC The range of long double is [-1.189731e+4932, -3.362103e-4932]∪[3.362103e-4932, 1.189731e+4932] This is weird, and I googled it, then just found this http://www.thescripts.com/forum/thread498535.html The LDBL_MAX of long double is&#8230;]]></description>
			<content:encoded><![CDATA[<p>I have tried to run this with both <strong>eclipse(CDT)+<em>MinGW</em></strong> and <strong>Cygwin+<em>GCC</em></strong></p>
<pre class="brush: cpp; title: ; notranslate">
int main() {
    puts(&quot;The range of &quot;);
    printf(&quot;tlong double is [%Le, %Le]∪[%Le, %Le]n&quot;, -LDBL_MAX, -LDBL_MIN, LDBL_MIN, LDBL_MAX);
    return EXIT_SUCCESS;
}
</pre>
<p>but got different results:</p>
<ul>
<li>In <strong>eclipse(CDT)+<em>MinGW</em></strong><br />
<span style="color: #999999;"> The range of<br />
long double is [<span style="color: #ff0000;">-1.#QNAN0e+000</span>, 3.237810e-319]∪[6.953674e-310, <span style="color: #ff0000;">0.000000e+000</span>]</span></li>
<li><span style="color: #000000;">In </span><strong>Cygwin+<em>GCC<br />
</em></strong><span style="color: #999999;">The range of<br />
long double is [<span style="color: #0000ff;">-1.189731e+4932</span>, -3.362103e-4932]∪[3.362103e-4932, <span style="color: #0000ff;">1.189731e+4932</span>]</span></li>
</ul>
<p>This is weird, and I googled it, then just found this <a href="http://www.thescripts.com/forum/thread498535.html" target="_blank">http://www.thescripts.com/forum/thread498535.html</a></p>
<p>The LDBL_MAX of long double is machine-dependent, but why it like this in same machine? I guess it&#8217;s the problem with MinGW. Anyone hv any idea?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/ldbl_max-1qnan0e000-with-mingw/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Append Session ID(SID) to Url Automatically When Cookies Are Forbidden</title>
		<link>http://www.guiguan.net/append-session-idsid-to-url-automatically-when-cookies-are-forbidden/</link>
		<comments>http://www.guiguan.net/append-session-idsid-to-url-automatically-when-cookies-are-forbidden/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 07:36:19 +0000</pubDate>
		<dc:creator>Guan Gui</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.guiguan.net/2007/11/append-session-idsid-to-url-automatically-when-cookies-are-forbidden/</guid>
		<description><![CDATA[Today, when I was reviewing the session part of PHP, I suddenly came out a question: how to make PHP to append session ID(SID) to your page links automatically when cookies are forbidden in that browser? I managed to do this in JSP, but not sure whether the PHP can also handle this problem. I&#8230;]]></description>
			<content:encoded><![CDATA[<p>Today, when I was reviewing the session part of PHP, I suddenly came out a question: how to make PHP to append session ID(SID) to your page links automatically when cookies are forbidden in that browser? I managed to do this in JSP, but not sure whether the PHP can also handle this problem.</p>
<p>I checked the configuration files (php.ini) for my apache server, and there is a session section, under which there is a setting <strong>session.use_trans_sid = 0</strong>. After I changed this to <strong>session.use_trans_sid = 1</strong>, and restarted apache, the links of the page which invoked <strong>session_start() </strong>have now appended the SID. There is also an <strong>url_rewriter.tags</strong>, with which you can define what elements of a page will be appended.</p>
<p>Here are some demo codes:</p>
<p><em>sessions.php</em></p>
<pre class="brush: php; html-script: true; title: ; notranslate">
&lt;?php ob_start(); ?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Untitled&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;?php
	ini_set('session.use_trans_sid','1'); //you can also do this instead of modify php.ini
	session_start();
	$_SESSION['test']='right!';
	//header('Location: sessions2.php'); //SID won't be appended in this situation
	//exit();
?&gt;
&lt;a href=&quot;sessions2.php&quot;&gt;click here&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php ob_end_flush(); ?&gt;
</pre>
<p><em>sessions2.php</em></p>
<pre class="brush: php; html-script: true; title: ; notranslate">
&lt;?php ob_start(); ?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Untitled&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;?php
	session_start();
	echo $_SESSION['test'];
?&gt;

&lt;/body&gt;
&lt;/html&gt;
&lt;?php ob_end_flush(); ?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.guiguan.net/append-session-idsid-to-url-automatically-when-cookies-are-forbidden/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

