<?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>BlueJacket With Silent &#187; OpenSource</title>
	<atom:link href="http://phpsrv.nutn.edu.tw/~silent/archives/category/opensource/feed" rel="self" type="application/rss+xml" />
	<link>http://phpsrv.nutn.edu.tw/~silent</link>
	<description>資訊技術手札</description>
	<lastBuildDate>Wed, 21 Sep 2011 09:35:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://phpsrv.nutn.edu.tw/~silent/?pushpress=hub'/>
	<div id='fb-root'></div>
					<script type='text/javascript'>
						window.fbAsyncInit = function()
						{
							FB.init({appId: null, status: true, cookie: true, xfbml: true});
						};
						(function()
						{
							var e = document.createElement('script'); e.async = true;
							e.src = document.location.protocol + '//connect.facebook.net/zh_TW/all.js';
							document.getElementById('fb-root').appendChild(e);
						}());
					</script>	
						<item>
		<title>[PFsense] Captive Portal Local認證+Radius</title>
		<link>http://phpsrv.nutn.edu.tw/~silent/archives/175</link>
		<comments>http://phpsrv.nutn.edu.tw/~silent/archives/175#comments</comments>
		<pubDate>Mon, 29 Nov 2010 00:15:27 +0000</pubDate>
		<dc:creator>水手</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[pfsense]]></category>

		<guid isPermaLink="false">http://phpsrv.nutn.edu.tw/~silent/?p=175</guid>
		<description><![CDATA[最近替一間學校的圖書館放了一台PFsense 要幫fat AP做captive portal.. PFsense預設只能選擇一種認證方式, 所以免不了要改程式&#8230; 請用shell方式登入 編輯/usr/local/captiveportal/index.php 找 把他們全部註解掉 or 刪除 再找 改成 觀念很簡單&#8230; 只是把原本註解的Local認證&#8230; 改到判斷radius的地方.. 優先從Local認證&#8230; 失敗後&#8230;再判斷radius&#8230; 改完後&#8230; 請把預設選項設定成RADIUS authentication]]></description>
			<content:encoded><![CDATA[<p>最近替一間學校的圖書館放了一台PFsense<br />
要幫fat AP做captive portal..</p>
<p>PFsense預設只能選擇一種認證方式,<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2010/11/pfsense-cp.png"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2010/11/pfsense-cp-300x68.png" alt="" title="pfsense-cp" width="300" height="68" class="alignnone size-medium wp-image-176" /></a><br />
所以免不了要改程式&#8230;<br />
<span id="more-175"></span><br />
請用shell方式登入<br />
編輯/usr/local/captiveportal/index.php<br />
找</p>
<pre class="brush: php; title: ; notranslate">
} else if ($_POST['accept'] &amp;&amp; $config['captiveportal']['auth_method'] == &quot;local&quot;) {

    //check against local usermanager
    $userdb = &amp;$config['captiveportal']['user'];

    $loginok = false;

    //erase expired accounts
    if (is_array($userdb)) {
        $moddb = false;
        for ($i = 0; $i &lt; count($userdb); $i++) {
            if ($userdb[$i]['expirationdate'] &amp;&amp; (strtotime(&quot;-1 day&quot;) &gt; strtotime($userdb[$i]['expirationdate']))) {
                unset($userdb[$i]);
                $moddb = true;
            }
        }
        if ($moddb)
            write_config();

        $userdb = &amp;$config['captiveportal']['user'];

        for ($i = 0; $i &lt; count($userdb); $i++) {
            if (($userdb[$i]['name'] == $_POST['auth_user']) &amp;&amp; ($userdb[$i]['password'] == md5($_POST['auth_pass']))) {
                $loginok = true;
                break;
            }
        }
    }

    if ($loginok){
        captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;LOGIN&quot;);
        portal_allow($clientip, $clientmac,$_POST['auth_user']);
    } else {
        captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;FAILURE&quot;);
        portal_reply_page($redirurl, &quot;error&quot;);
    }
</pre>
<p>把他們全部註解掉 or 刪除</p>
<p>再找</p>
<pre class="brush: php; title: ; notranslate">
} else if ($_POST['accept'] &amp;&amp; $radius_enable) {

    if ($_POST['auth_user'] &amp;&amp; $_POST['auth_pass']) {
        $auth_list = radius($_POST['auth_user'],$_POST['auth_pass'],$clientip,$clientmac,&quot;USER LOGIN&quot;);

        if ($auth_list['auth_val'] == 1) {
            captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;ERROR&quot;,$auth_list['error']);
            portal_reply_page($redirurl, &quot;error&quot;, $auth_list['error']);
        }
        else if ($auth_list['auth_val'] == 3) {
            captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;FAILURE&quot;,$auth_list['reply_message']);
            portal_reply_page($redirurl, &quot;error&quot;, $auth_list['reply_message']);
        }
    } else {
        captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;ERROR&quot;);
        portal_reply_page($redirurl, &quot;error&quot;);
    }
</pre>
<p>改成</p>
<pre class="brush: php; title: ; notranslate">
} else if ($_POST['accept'] &amp;&amp; $radius_enable) {

    //check against local usermanager
    $userdb = &amp;$config['captiveportal']['user'];

    $loginok = false;

    //erase expired accounts
    if (is_array($userdb)) {
        $moddb = false;
        for ($i = 0; $i &lt; count($userdb); $i++) {
            if ($userdb[$i]['expirationdate'] &amp;&amp; (strtotime(&quot;-1 day&quot;) &gt; strtotime($userdb[$i]['expirationdate']))) {
                unset($userdb[$i]);
                $moddb = true;
            }
        }
        if ($moddb)
            write_config();

        $userdb = &amp;$config['captiveportal']['user'];

        for ($i = 0; $i &lt; count($userdb); $i++) {
            if (($userdb[$i]['name'] == $_POST['auth_user']) &amp;&amp; ($userdb[$i]['password'] == md5($_POST['auth_pass']))) {
                $loginok = true;
                break;
            }
        }
    }

    if ($loginok){
        captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;LOGIN&quot;);
        portal_allow($clientip, $clientmac,$_POST['auth_user']);
    } else {
        if ($_POST['auth_user'] &amp;&amp; $_POST['auth_pass']) {
            $auth_list = radius($_POST['auth_user'],$_POST['auth_pass'],$clientip,$clientmac,&quot;USER LOGIN&quot;);

            if ($auth_list['auth_val'] == 1) {
                captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;ERROR&quot;,$auth_list['error']);
                portal_reply_page($redirurl, &quot;error&quot;, $auth_list['error']);
            }
            else if ($auth_list['auth_val'] == 3) {
                captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;FAILURE&quot;,$auth_list['reply_message']);
                portal_reply_page($redirurl, &quot;error&quot;, $auth_list['reply_message']);
            }
        } else {
            captiveportal_logportalauth($_POST['auth_user'],$clientmac,$clientip,&quot;ERROR&quot;);
            portal_reply_page($redirurl, &quot;error&quot;);
        }
    }
</pre>
<p>觀念很簡單&#8230;<br />
只是把原本註解的Local認證&#8230;<br />
改到判斷radius的地方..<br />
優先從Local認證&#8230;<br />
失敗後&#8230;再判斷radius&#8230;</p>
<p>改完後&#8230;<br />
請把預設選項設定成RADIUS authentication</p>
<div class='wpfblike' style='height: 40px;'><fb:like href='http://phpsrv.nutn.edu.tw/~silent/archives/175' layout='button_count' show_faces='true' width='400' action='like' colorscheme='light' send='true' /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsrv.nutn.edu.tw/~silent/archives/175/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>openwebmail 2.53版 問題修正紀錄</title>
		<link>http://phpsrv.nutn.edu.tw/~silent/archives/122</link>
		<comments>http://phpsrv.nutn.edu.tw/~silent/archives/122#comments</comments>
		<pubDate>Mon, 01 Mar 2010 15:13:58 +0000</pubDate>
		<dc:creator>水手</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[openwebmail]]></category>

		<guid isPermaLink="false">http://phpsrv.nutn.edu.tw/~silent/?p=122</guid>
		<description><![CDATA[雖然openwebmail 現有 Current Development Site 還在修正 Bugs 但是裝上去之後對中文字還是會有不太相容的問題&#8230; 所以只好一個一個解決現有的問題了 通訊錄亂碼： 這個部份可以參考我以前學校的師父的說明 http://phorum.study-area.org/index.php?topic=50495.0#msg275602 1. 編輯你的語系裡的 composemessage.template 檔 2. 找到下列的程式碼 3. 將上面這3行改成下面這樣 所見即所得編輯器在IE6無法啟動： 2.53版使用的編輯器是HTMLArea 3.0 Beta 這版在IE6會無法啟動&#8230; 所以只要當內文是html格式.. 會無法轉換，變成直接顯示html原始碼 google了一下&#8230;好像也沒有patch可以修正.. 索性直接換掉這套古老的編輯器 &#8230; Dev版是使用xinha&#8230; 在trace 後發現他改了太多架構&#8230; so&#8230;就換成我習慣使用的FCKeditor 這套編輯器支援相當多常用的程式語言&#8230; 對瀏覽器的相容性也很高&#8230; 這次要使用js載入的方式來做 將下載完的檔案解壓縮後上傳到javascript/ 設定fckconfig.js 再來就是要改 openwebmail-send.pl 找到 if ($_htmlarea_css_cache eq ") { 將以下程式刪除 再將以下程式做替換 換成 若想要讓chrome也可以使用html編輯器 找 sub htmlarea_compatible { [...]]]></description>
			<content:encoded><![CDATA[<p>雖然openwebmail 現有 <a href="http://openwebmail.acatysmoof.com/" target="_blank">Current Development Site</a> 還在修正 Bugs<br />
但是裝上去之後對中文字還是會有不太相容的問題&#8230;</p>
<p>所以只好一個一個解決現有的問題了<br />
<span id="more-122"></span><br />
<strong>通訊錄亂碼：</strong><br />
這個部份可以參考我以前學校的師父的說明 <a href="http://phorum.study-area.org/index.php?topic=50495.0#msg275602">http://phorum.study-area.org/index.php?topic=50495.0#msg275602</a><br />
1. 編輯你的語系裡的 composemessage.template 檔</p>
<pre class="brush: plain; title: ; notranslate">
vi cgi-bin/openwebmail/etc/templates/zh_TW.Big5/composemessage.template
</pre>
<p>2. 找到下列的程式碼</p>
<pre class="brush: plain; title: ; notranslate">
url += &quot;&amp;to=&quot; + escape (document.composeform.to.value);
url += &quot;&amp;cc=&quot; + escape (document.composeform.cc.value);
url += &quot;&amp;bcc=&quot; + escape (document.composeform.bcc.value);
</pre>
<p>3. 將上面這3行改成下面這樣</p>
<pre class="brush: plain; title: ; notranslate">
url += &quot;&amp;to=&quot; + document.composeform.to.value;
url += &quot;&amp;cc=&quot; + document.composeform.cc.value;
url += &quot;&amp;bcc=&quot; + document.composeform.bcc.value;
</pre>
<p><strong>所見即所得編輯器在IE6無法啟動：</strong><br />
2.53版使用的編輯器是HTMLArea 3.0 Beta<br />
這版在IE6會無法啟動&#8230;<br />
所以只要當內文是html格式..<br />
會無法轉換，變成直接顯示html原始碼</p>
<p>google了一下&#8230;好像也沒有patch可以修正..<br />
索性直接換掉這套古老的編輯器 &#8230;<br />
Dev版是使用xinha&#8230;<br />
在trace 後發現他改了太多架構&#8230;<br />
so&#8230;就換成我習慣使用的FCKeditor<br />
這套編輯器支援相當多常用的程式語言&#8230;<br />
對瀏覽器的相容性也很高&#8230;<br />
這次要使用js載入的方式來做</p>
<p>將下載完的檔案解壓縮後上傳到javascript/<br />
設定fckconfig.js</p>
<p>再來就是要改 openwebmail-send.pl<br />
找到 if ($_htmlarea_css_cache eq ") {<br />
將以下程式刪除</p>
<pre class="brush: perl; title: ; notranslate">
if ($_htmlarea_css_cache eq '') {
  sysopen(F, &quot;$config{'ow_htmldir'}/javascript/htmlarea.openwebmail/htmlarea.css&quot;, O_RDONLY) or
  openwebmailerror(__FILE__, __LINE__, &quot;$lang_err{'couldnt_read'} $config{'ow_htmldir'}/javascript/htmlarea.openwebmail/htmlarea.css! ($!)&quot;);
  local $/; undef $/; $_htmlarea_css_cache=&lt;F&gt;; # read whole file in once
  close(F);
}

my $css = $_htmlarea_css_cache;
$css =~ s/\@\@\@BGCOLOR\@\@\@/$style{'window_light'}/g;
$css =~ s/&quot;//g;
</pre>
<p>再將以下程式做替換</p>
<pre class="brush: perl; title: ; notranslate">
$html= qq|&lt;script language=&quot;JavaScript&quot; src=&quot;$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/htmlarea.js&quot;&gt;&lt;/script&gt;\n|.
qq|&lt;script language=&quot;JavaScript&quot; src=&quot;$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/dialog.js&quot;&gt;&lt;/script&gt;\n|.
qq|&lt;script language=&quot;JavaScript&quot; src=&quot;$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/popups/$htmlarealocale/htmlarea-lang.js&quot;&gt;&lt;/script&gt;\n|.
$html.
qq|&lt;style type=&quot;text/css&quot;&gt;\n$css\n&lt;/style&gt;\n|.
qq|&lt;script language=&quot;JavaScript&quot;&gt;\n&lt;!--\n|.
qq| var editor=new HTMLArea(&quot;body&quot;);\n|.
qq| editor.config.editorURL = &quot;$config{'ow_htmlurl'}/javascript/htmlarea.openwebmail/&quot;;\n|.
qq| editor.config.imgURL = &quot;images/&quot;;\n|.
qq| editor.config.popupURL = &quot;popups/$htmlarealocale/&quot;;\n|.
qq| editor.config.bodyDirection = &quot;$direction&quot;;\n|.
qq| editor.config.attlist = {\n$htmlarea_attlist_js};\n|.
qq| editor.config.attlist = {\n$htmlarea_attlist_js};\n|.
qq| editor.generate();\n|.
qq|//--&gt;\n&lt;/script&gt;\n|;
</pre>
<p>換成</p>
<pre class="brush: perl; title: ; notranslate">
$html= qq|&lt;script language=&quot;JavaScript&quot; src=&quot;$config{'ow_htmlurl'}/javascript/fckeditor/fckeditor.js&quot;&gt;&lt;/script&gt;\n|.
$html.
qq|&lt;script language=&quot;JavaScript&quot;&gt;\n&lt;!--\n|.
qq| var editor=new FCKeditor(&quot;body&quot;);\n|.
qq| editor.BasePath = &quot;$config{'ow_htmlurl'}/javascript/fckeditor/&quot;;\n|.
qq| editor.Height = &quot;550&quot;;\n|.
qq| editor.ReplaceTextarea();\n|.
qq|//--&gt;\n&lt;/script&gt;\n|;
</pre>
<p>若想要讓chrome也可以使用html編輯器<br />
找 sub htmlarea_compatible {<br />
將以下程式替換</p>
<pre class="brush: perl; title: ; notranslate">
my $u=$ENV{'HTTP_USER_AGENT'};
if ( $u=~m!Mozilla/4.0! &amp;&amp;
  $u=~m!compatible;!) {
  return 0 if ($u=~m!Opera!);	# not Opera
  if ($u=~m!Windows! &amp;&amp;
  $u=~m!MSIE ([\d\.]+)! ) {
    return 1 if ($1&gt;=5.5);	 # MSIE&gt;=5.5 on windows platform
  }
}
if ( $u=~m!Mozilla/5.0! &amp;&amp;
  $u!~m!compatible;!) {
  if ($u!~m!(?:Phoenix|Galeon|Firebird)/! &amp;&amp;
    $u=~m!rv:([\d\.]+)! ) {
    return 1 if ($1 ge &quot;1.3&quot;);	# full Mozilla&gt;=1.3 on all plaform
  }
  if ($u=~m!Firebird/([\d\.]+)!) {
    return 1 if ($1 ge &quot;0.6.1&quot;);	# Firebird&gt;=0.6.1 on all plaform
  }
}
return 0;
</pre>
<p>替換成</p>
<pre class="brush: perl; title: ; notranslate">
return 1;
</pre>
<p><strong>中文會有 [UTF-8?] 字樣：</strong><br />
這是針對使用Big5編碼的人&#8230;<br />
若是使用UTF-8..則是會出現[BIG5?]</p>
<p>這個可以參考 <a href="http://www.to2100.idv.tw/?p=5358" target="_blank">http://www.to2100.idv.tw/?p=5358</a><br />
但目前我還不打算改這部份&#8230;</p>
<hr />發現問題出在shares/iconv.pl<br />
找到</p>
<pre class="brush: perl; title: ; notranslate">sub _iconv {</pre>
<p>裡面的一個回傳值</p>
<pre class="brush: perl; title: ; notranslate">return &quot;[&quot;.uc($from).&quot;?]&quot;.$s;</pre>
<p>他的註解說如果轉換失敗，就會把來源編碼貼在字串的開頭&#8230;<br />
只是&#8230;一般我們所看到的大部分文字都顯示正常&#8230;卻被貼上這個mark&#8230;<br />
還不太瞭解他為何會是轉換失敗&#8230;</p>
<p>目前先把這串改成</p>
<pre class="brush: perl; title: ; notranslate">return $s;</pre>
<p>這樣就不會在出現那個討厭的mark&#8230;.</p>
<hr />另一個方法則是捨去_iconv這個function<br />
採用Encode的方式來做<br />
一樣是在iconv.pl<br />
在</p>
<pre class="brush: perl; title: ; notranslate">use Text::Iconv;</pre>
<p>下方加入</p>
<pre class="brush: perl; title: ; notranslate">use Encode qw/encode decode/;</pre>
<p>找到</p>
<pre class="brush: perl; title: ; notranslate">$text[$i]=~s/(\S+)/_iconv($from, $to, $1)/egis;</pre>
<p>用下方程式取代</p>
<pre class="brush: perl; title: ; notranslate">$text[$i]=~s/(\S+)/encode($to, decode($from, $1))/egis;</pre>
<p>這樣也可以達到相同效果,<br />
而且也可以大致上將編碼轉換過來,<br />
轉不過來的字會變成?<br />
至少&#8230;不會都是奇怪的方框了&#8230;</p>
<p><strong>20100304</strong><br />
今天發現有人信箱會開不起來&#8230;<br />
顯示Encode error&#8230;.<br />
因為他的信裡面有怪編碼&#8230;.導致無法Encode&#8230;<br />
所以只好改回上面的 return $s; 這個方法了</p>
<div class='wpfblike' style='height: 40px;'><fb:like href='http://phpsrv.nutn.edu.tw/~silent/archives/122' layout='button_count' show_faces='true' width='400' action='like' colorscheme='light' send='true' /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsrv.nutn.edu.tw/~silent/archives/122/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>xoops 2.3.3 登入問題</title>
		<link>http://phpsrv.nutn.edu.tw/~silent/archives/111</link>
		<comments>http://phpsrv.nutn.edu.tw/~silent/archives/111#comments</comments>
		<pubDate>Sat, 07 Nov 2009 06:27:55 +0000</pubDate>
		<dc:creator>水手</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Xoops]]></category>

		<guid isPermaLink="false">http://phpsrv.nutn.edu.tw/~silent/?p=111</guid>
		<description><![CDATA[最近又發生登入的問題&#8230; 以為又是上一篇的問題&#8230; 查到的結果還好不是 在kernel/session.php裡面.. 有一個$securityLevel 的設定.. 在第129行開始&#8230; 進行sess_ip跟使用者ip的比對判斷 我只能說&#8230; 如果使用者環境是NAT ip pool 在這邊sess_data就會一直被清空.. 要好好思考到底要不要使用這個設定了&#8230; 不使用的話就把$securityLevel設成0吧&#8230; p.s 這個問題在2.0.17版好像就開始存在了&#8230;]]></description>
			<content:encoded><![CDATA[<p>最近又發生登入的問題&#8230;<br />
以為又是上一篇的問題&#8230;</p>
<p>查到的結果還好不是<br />
<span id="more-111"></span><br />
在kernel/session.php裡面..<br />
有一個$securityLevel 的設定..</p>
<pre class="brush: php; title: ; notranslate">
/**
* Security checking level
*
* Possible value:
* 0 - no check;
* 1 - check browser characteristics (HTTP_USER_AGENT/HTTP_ACCEPT_LANGUAGE), to be implemented in the future now;
* 2 - check browser and IP A.B;
* 3 - check browser and IP A.B.C, recommended;
* 4 - check browser and IP A.B.C.D;
*
* @var int
* @access public
*/
var $securityLevel = 3;
</pre>
<p>在第129行開始&#8230;<br />
進行sess_ip跟使用者ip的比對判斷</p>
<pre class="brush: php; title: ; notranslate">
if ($this-&gt;securityLevel &gt; 1) {
  $pos = strpos($sess_ip, &quot;.&quot;, $this-&gt;securityLevel - 1);
  if (strncmp($sess_ip, $_SERVER['REMOTE_ADDR'], $pos)) {
    $sess_data = '';
  }
}
</pre>
<p>我只能說&#8230;<br />
如果使用者環境是NAT ip pool<br />
在這邊sess_data就會一直被清空..<br />
要好好思考到底要不要使用這個設定了&#8230;<br />
不使用的話就把$securityLevel設成0吧&#8230;</p>
<p>p.s 這個問題在2.0.17版好像就開始存在了&#8230; </p>
<div class='wpfblike' style='height: 40px;'><fb:like href='http://phpsrv.nutn.edu.tw/~silent/archives/111' layout='button_count' show_faces='true' width='400' action='like' colorscheme='light' send='true' /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsrv.nutn.edu.tw/~silent/archives/111/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xoops 2.0.16a 之前版本發生登入成功, 卻還是在登入的問題</title>
		<link>http://phpsrv.nutn.edu.tw/~silent/archives/79</link>
		<comments>http://phpsrv.nutn.edu.tw/~silent/archives/79#comments</comments>
		<pubDate>Sat, 12 Sep 2009 02:10:44 +0000</pubDate>
		<dc:creator>水手</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Xoops]]></category>

		<guid isPermaLink="false">http://phpsrv.nutn.edu.tw/~silent/?p=79</guid>
		<description><![CDATA[這個問題存在已久, 網路上一般都是將session這個table修復, 再不行, 就重新建立這個table&#8230; 但&#8230;問題並不完全出在此&#8230;. 官網上有說明是因為php版本的問題&#8230; 雖然有釋出修正程式&#8230;但是好像沒有效果&#8230;. 因為這個問題並不是每個人都會遇到.. 剛好今天在研究這個問題時&#8230;突然就發生了&#8230; 趁這個機會來看看到底哪裡出問題 正常狀態下&#8230;當瀏覽器開啟xoops的網頁時&#8230; session table會寫入sess_id、sess_updated、sess_ip, sess_data是空值&#8230; 登入後&#8230;sess_data才會有資料, 但問題發生, 當瀏覽器開啟xoops的網頁時&#8230; sess_id卻是空值&#8230;sess_updated、sess_ip有資料 登入後&#8230;sess_id依舊是空值&#8230;但sess_data卻有資料&#8230; 所以在網頁上才會呈現&#8230;.感謝您的登入&#8230;但實際上卻還是在登入狀態&#8230;. 因為&#8230;.sess_id消失了&#8230;.. 我拿了xoops 2.3.3版的來做比較（xoopscube因為全部改成物件&#8230;程式差異太大&#8230;無法拿來比較） 檢查了/kernel/session.php /include/checklogin.php /include/common.php 他們都有些許的差異&#8230;.但問題是出在common.php這裡 x233版&#8230; 在237行的Login a user with a valid session註解下 他先將 $sess_handler 宣告成全域變數&#8230; 在if ( !is_object($xoopsUser)底下 加了session_destroy();&#8230; 利用sess_handler這個全域變數&#8230;呼叫他的update_cookie來寫入cookie 再來判斷$_SESSION['xoopsUserGroups']是否存在&#8230; 來決定是否寫入或直接讀取Groups&#8230;. 但最終問題應該是出在sess_handler這個全域變數&#8230; 可能原因是&#8230;.xoops之前版本都是針對舊版php來抓取session 但新版因為安全性的問題&#8230;修正了部份對session的處理&#8230; 導致這個問題發生&#8230;. 但很奇妙的是&#8230;我發生問題的是IE&#8230; 然後用google chromium開&#8230;卻抓的到sess_id 不管IE怎麼清除資料&#8230;.不給抓就是不給抓&#8230;. 目前改完之後&#8230;session table裡是沒有再出現sess_id空的狀況&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>這個問題存在已久,</p>
<p>網路上一般都是將session這個table修復,<br />
再不行, 就重新建立這個table&#8230;</p>
<p>但&#8230;問題並不完全出在此&#8230;.<br />
官網上有說明是因為php版本的問題&#8230;<br />
雖然有釋出修正程式&#8230;但是好像沒有效果&#8230;.</p>
<p>因為這個問題並不是每個人都會遇到..<br />
剛好今天在研究這個問題時&#8230;突然就發生了&#8230;<br />
趁這個機會來看看到底哪裡出問題<br />
<span id="more-79"></span><br />
正常狀態下&#8230;當瀏覽器開啟xoops的網頁時&#8230;<br />
session table會寫入sess_id、sess_updated、sess_ip,<br />
sess_data是空值&#8230;<br />
登入後&#8230;sess_data才會有資料,</p>
<p>但問題發生, 當瀏覽器開啟xoops的網頁時&#8230;<br />
sess_id卻是空值&#8230;sess_updated、sess_ip有資料<br />
登入後&#8230;sess_id依舊是空值&#8230;但sess_data卻有資料&#8230;</p>
<p>所以在網頁上才會呈現&#8230;.感謝您的登入&#8230;但實際上卻還是在登入狀態&#8230;.<br />
因為&#8230;.sess_id消失了&#8230;..</p>
<p>我拿了xoops 2.3.3版的來做比較（xoopscube因為全部改成物件&#8230;程式差異太大&#8230;無法拿來比較）<br />
檢查了/kernel/session.php /include/checklogin.php /include/common.php<br />
他們都有些許的差異&#8230;.但問題是出在common.php這裡</p>
<p>x233版&#8230;<br />
在237行的Login a user with a valid session註解下<br />
他先將 $sess_handler 宣告成全域變數&#8230;</p>
<pre class="brush: php; title: ; notranslate">
// ############## Login a user with a valid session ##############
$xoopsUser = '';
$xoopsUserIsAdmin = false;
$member_handler =&amp; xoops_gethandler('member');
global $sess_handler;
$sess_handler =&amp; xoops_gethandler('session');
</pre>
<p>在if ( !is_object($xoopsUser)底下<br />
加了session_destroy();&#8230;<br />
利用sess_handler這個全域變數&#8230;呼叫他的update_cookie來寫入cookie<br />
再來判斷$_SESSION['xoopsUserGroups']是否存在&#8230;<br />
來決定是否寫入或直接讀取Groups&#8230;.</p>
<pre class="brush: php; title: ; notranslate">
if ( !is_object($xoopsUser)) ) {
  $xoopsUser = '';
  $_SESSION = array();
  session_destroy();
} else {
  $GLOBALS[&quot;sess_handler&quot;]-&gt;update_cookie();
  if (isset($_SESSION['xoopsUserGroups'])) {
    $xoopsUser-&gt;setGroups($_SESSION['xoopsUserGroups']);
  } else {
    $_SESSION['xoopsUserGroups'] = $xoopsUser-&gt;getGroups();
  }
  $xoopsUserIsAdmin = $xoopsUser-&gt;isAdmin();
}
</pre>
<p>但最終問題應該是出在sess_handler這個全域變數&#8230;<br />
可能原因是&#8230;.xoops之前版本都是針對舊版php來抓取session<br />
但新版因為安全性的問題&#8230;修正了部份對session的處理&#8230;<br />
導致這個問題發生&#8230;.</p>
<p>但很奇妙的是&#8230;我發生問題的是IE&#8230;<br />
然後用google chromium開&#8230;卻抓的到sess_id<br />
不管IE怎麼清除資料&#8230;.不給抓就是不給抓&#8230;.</p>
<p>目前改完之後&#8230;session table裡是沒有再出現sess_id空的狀況&#8230;<br />
我的IE也恢復正常登入&#8230;.<br />
再持續觀察吧&#8230;.</p>
<div class='wpfblike' style='height: 40px;'><fb:like href='http://phpsrv.nutn.edu.tw/~silent/archives/79' layout='button_count' show_faces='true' width='400' action='like' colorscheme='light' send='true' /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsrv.nutn.edu.tw/~silent/archives/79/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XOOPS CUBE Legacy 2.2.0 alpha 釋出</title>
		<link>http://phpsrv.nutn.edu.tw/~silent/archives/65</link>
		<comments>http://phpsrv.nutn.edu.tw/~silent/archives/65#comments</comments>
		<pubDate>Mon, 29 Jun 2009 02:10:33 +0000</pubDate>
		<dc:creator>水手</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Xoops]]></category>

		<guid isPermaLink="false">http://phpsrv.nutn.edu.tw/~silent/?p=65</guid>
		<description><![CDATA[昨日官網釋出2.20 alpha.. 所以今天趕緊來試玩看看&#8230; 基本上是針對頁面及功能面向來談&#8230; 2.2版加入了一些以往使用者非常需要的功能&#8230; 會員匯入匯出、自訂會員欄位&#8230;. 整體的配色、排版也稍稍的調整了&#8230; 操作方面沒有變動太大，與2.1x版相似&#8230;所以還蠻好上手的 接下來，我們來看看有哪些差別囉&#8230;. 安裝畫面變得粉嫩、簡約明瞭 安裝完首頁, 變得比較像Blog的樣式&#8230;選單預設也改成右邊, 與官網一樣.. 後台的部份, 把一些常用的功能放在上方,左方功能選單也可以縮放 模組的圖形, 也重新設計囉&#8230; 還有一個超級方便的&#8230;會員帳號匯入匯出&#8230;（以前超想要有這個功能..x_user可以退休了） 另一個超級振奮的功能&#8230;自訂會員欄位&#8230; 新模組&#8230;檔案管理(還沒做好&#8230;期待中&#8230;.) 更多詳細的內容可以參考&#8230;.（小弟看不懂日文&#8230;.=.=&#124;&#124;） XOOPS Cube Official Site]]></description>
			<content:encoded><![CDATA[<p>昨日官網釋出2.20 alpha..<br />
所以今天趕緊來試玩看看&#8230;</p>
<p>基本上是針對頁面及功能面向來談&#8230;<br />
2.2版加入了一些以往使用者非常需要的功能&#8230;<br />
會員匯入匯出、自訂會員欄位&#8230;.<br />
整體的配色、排版也稍稍的調整了&#8230;<br />
操作方面沒有變動太大，與2.1x版相似&#8230;所以還蠻好上手的</p>
<p>接下來，我們來看看有哪些差別囉&#8230;.<br />
<span id="more-65"></span></p>
<p>安裝畫面變得粉嫩、簡約明瞭<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=67" rel="attachment wp-att-67"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2010/06/x22_1-300x136.jpg" alt="" title="x22_1" width="300" height="136" class="alignnone size-medium wp-image-67" /></a></p>
<p>安裝完首頁, 變得比較像Blog的樣式&#8230;選單預設也改成右邊, 與官網一樣..<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=70" rel="attachment wp-att-70"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2009/06/x22_2-300x198.jpg" alt="" title="x22_2" width="300" height="198" class="alignnone size-medium wp-image-70" /></a></p>
<p>後台的部份, 把一些常用的功能放在上方,左方功能選單也可以縮放<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=71" rel="attachment wp-att-71"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2009/06/x22_3-300x204.jpg" alt="" title="x22_3" width="300" height="204" class="alignnone size-medium wp-image-71" /></a></p>
<p>模組的圖形, 也重新設計囉&#8230;<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=72" rel="attachment wp-att-72"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2009/06/x22_4-300x199.jpg" alt="" title="x22_4" width="300" height="199" class="alignnone size-medium wp-image-72" /></a></p>
<p>還有一個超級方便的&#8230;會員帳號匯入匯出&#8230;（以前超想要有這個功能..x_user可以退休了）<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=73" rel="attachment wp-att-73"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2009/06/x22_5-300x185.jpg" alt="" title="x22_5" width="300" height="185" class="alignnone size-medium wp-image-73" /></a></p>
<p>另一個超級振奮的功能&#8230;自訂會員欄位&#8230;<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=74" rel="attachment wp-att-74"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2009/06/x22_6-300x142.jpg" alt="" title="x22_6" width="300" height="142" class="alignnone size-medium wp-image-74" /></a><br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=75" rel="attachment wp-att-75"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2009/06/x22_7-300x205.jpg" alt="" title="x22_7" width="300" height="205" class="alignnone size-medium wp-image-75" /></a></p>
<p>新模組&#8230;檔案管理(還沒做好&#8230;期待中&#8230;.)<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/?attachment_id=76" rel="attachment wp-att-76"><img src="http://phpsrv.nutn.edu.tw/~silent/wp-content/uploads/2009/06/x22_8-300x188.jpg" alt="" title="x22_8" width="300" height="188" class="alignnone size-medium wp-image-76" /></a></p>
<p>更多詳細的內容可以參考&#8230;.（小弟看不懂日文&#8230;.=.=||）<br />
<a target="_blank" href="http://xoopscube.sourceforge.net/ja/index_files/f113e49f30aa8d3d66b396439be0c6f7-31.html">XOOPS Cube Official Site</a></p>
<div class='wpfblike' style='height: 40px;'><fb:like href='http://phpsrv.nutn.edu.tw/~silent/archives/65' layout='button_count' show_faces='true' width='400' action='like' colorscheme='light' send='true' /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsrv.nutn.edu.tw/~silent/archives/65/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XCL for Ucenter 1.0.0</title>
		<link>http://phpsrv.nutn.edu.tw/~silent/archives/44</link>
		<comments>http://phpsrv.nutn.edu.tw/~silent/archives/44#comments</comments>
		<pubDate>Sun, 13 Jul 2008 02:19:36 +0000</pubDate>
		<dc:creator>水手</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Discuz]]></category>
		<category><![CDATA[Xoops]]></category>

		<guid isPermaLink="false">http://phpsrv.nutn.edu.tw/~silent/?p=44</guid>
		<description><![CDATA[XCL Version : 2.1.4 Ucenter Version : 1.0.0 整合完成： 雙向同步登入、登出。 以XCL User為主，判斷Ucenter User是否存在。 由於Ucenter核心並無整合uid，所以整合程式暫時停止開發， 希望Ucenter新的版本可以修正&#8230;..]]></description>
			<content:encoded><![CDATA[<p>XCL Version : 2.1.4<br />
Ucenter Version : 1.0.0</p>
<p>整合完成：<br />
雙向同步登入、登出。<br />
以XCL User為主，判斷Ucenter User是否存在。<br />
由於Ucenter核心並無整合uid，所以整合程式暫時停止開發，<br />
希望Ucenter新的版本可以修正&#8230;..<br />
<a href="http://phpsrv.nutn.edu.tw/~silent/wp-content/plugins/download-monitor/download.php?id=2">整合程式1.0版 - 34.45 kB</a> - 下載次數 104</p>
<div class='wpfblike' style='height: 40px;'><fb:like href='http://phpsrv.nutn.edu.tw/~silent/archives/44' layout='button_count' show_faces='true' width='400' action='like' colorscheme='light' send='true' /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsrv.nutn.edu.tw/~silent/archives/44/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Discuz 通行證設定 for Xoops2</title>
		<link>http://phpsrv.nutn.edu.tw/~silent/archives/37</link>
		<comments>http://phpsrv.nutn.edu.tw/~silent/archives/37#comments</comments>
		<pubDate>Tue, 26 Feb 2008 09:37:38 +0000</pubDate>
		<dc:creator>水手</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Discuz]]></category>
		<category><![CDATA[Xoops]]></category>

		<guid isPermaLink="false">http://phpsrv.nutn.edu.tw/~silent/?p=37</guid>
		<description><![CDATA[網路都找不到&#8230;..xoops4u也不見了&#8230;&#8230; 還好之前改4.0版有留著… 剛剛改了是可以正常使用的， 環境是 Xoops 2.0.16 Discuz 6.0.0 有空再整理上來，敬請期待]]></description>
			<content:encoded><![CDATA[<p>網路都找不到&#8230;..xoops4u也不見了&#8230;&#8230;</p>
<p>還好之前改4.0版有留著…</p>
<p>剛剛改了是可以正常使用的，</p>
<p>環境是<br />
Xoops 2.0.16<br />
Discuz 6.0.0</p>
<p>有空再整理上來，敬請期待</p>
<div class='wpfblike' style='height: 40px;'><fb:like href='http://phpsrv.nutn.edu.tw/~silent/archives/37' layout='button_count' show_faces='true' width='400' action='like' colorscheme='light' send='true' /></div>]]></content:encoded>
			<wfw:commentRss>http://phpsrv.nutn.edu.tw/~silent/archives/37/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

