<?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>oue&#039;s profile &#187; webboard</title>
	<atom:link href="http://www.aspgod.com/tag/webboard/feed" rel="self" type="application/rss+xml" />
	<link>http://www.aspgod.com</link>
	<description>AI algorithm graphics programming blog Firefox ff</description>
	<lastBuildDate>Fri, 20 Jan 2012 16:59:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Get Login Session from phpBB</title>
		<link>http://www.aspgod.com/phpbb/get-login-session-from-phpbb.html</link>
		<comments>http://www.aspgod.com/phpbb/get-login-session-from-phpbb.html#comments</comments>
		<pubDate>Sat, 13 Mar 2010 09:26:27 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[phpBB]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[Login Integration]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[webboard]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=450</guid>
		<description><![CDATA[นี่เป็นวิธีในการ get สถานะ login จาก phpBB คือจริงๆแล้วเรายังคงใช้การ login/logout ด้วย phpBB เหมือนเดิม เพียงแต่ถ้าหน้าจออื่นๆต้องการใช้ประโยชน์จากการ login ด้วย เช่นหน้านี้ต้อง login ก่อนเท่านั้นถึงเข้าดูได้ ซึ่งเป็นส่วนที่นอกเหนือจาก phpBB ให้เราใส่ code ต่อไปนี้ไว้ในหน้าที่ต้องการ เราก็จะรู้ว่า user คนนั้น login อยู่รึไม่ สำหรับ phpBB 3 ขึ้นไปเท่านั้น 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>นี่เป็นวิธีในการ get สถานะ login จาก phpBB คือจริงๆแล้วเรายังคงใช้การ login/logout ด้วย phpBB เหมือนเดิม เพียงแต่ถ้าหน้าจออื่นๆต้องการใช้ประโยชน์จากการ login ด้วย เช่นหน้านี้ต้อง login ก่อนเท่านั้นถึงเข้าดูได้ ซึ่งเป็นส่วนที่นอกเหนือจาก phpBB ให้เราใส่ code ต่อไปนี้ไว้ในหน้าที่ต้องการ เราก็จะรู้ว่า user คนนั้น login อยู่รึไม่<br />
<strong><br />
สำหรับ phpBB 3 ขึ้นไปเท่านั้น</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$phpEx</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'php'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Added to define the variable as the appropriate extension, no extension.inc file in phpBB3</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IN_PHPBB'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$phpbb_root_path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'./webboard/'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// set this as the path to your phpBB installation</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$phpbb_root_path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'common.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$phpEx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$phpbb_root_path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'includes/functions_user.'</span><span style="color: #339933;">.</span><span style="color: #000088;">$phpEx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// Start session management</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">session_begin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$nickname</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
&lt;html&gt;
   &lt;head&gt;
        &lt;title&gt;Login Authentication&lt;/title&gt;
        &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
        &lt;style type=&quot;text/css&quot;&gt;
                html,body,iframe { border: 0; height: 100%; margin: 0; overflow: hidden; padding: 0; }
                iframe { height: 100%; width: 100%; }
        &lt;/style&gt;
   &lt;/head&gt;
   &lt;body&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nickname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;p/&gt;&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>ตัวที่ถูก echo ออกมาคือ $nickname ถ้าไม่ได้ login ค่าก็จะกลายเป็น Anonymous ดังนั้นเราควรเช็คจากจุดนี้ว่า $nickname เท่ากับ Anonymous หรือไม่ จึงจะรู้ว่าตอนนี้สถานะการ login เป็นอย่างไร</p>
<p>หวังว่าจะมีประโยชน์กับทุกๆคนนะครับ</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/phpbb/get-login-session-from-phpbb.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>phpBB Login and Redirect with Modifying Code</title>
		<link>http://www.aspgod.com/phpbb/phpbb-login-and-redirect-with-modifying-code.html</link>
		<comments>http://www.aspgod.com/phpbb/phpbb-login-and-redirect-with-modifying-code.html#comments</comments>
		<pubDate>Fri, 12 Mar 2010 15:56:06 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[phpBB]]></category>
		<category><![CDATA[cross domain]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[Login Integration]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[webboard]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=442</guid>
		<description><![CDATA[ต่อเนื่องจากเนื้อหาคราวก่อนในการ Login Integration กับ phpBB นั้น หากเราไม่ต้องการทำอะไรเกี่ยวกับการ login/logout เลย ให้ใช้ระบบ login ของ phpBB โดยพลัน แต่ต้องทำการแก้โค๊ดนิดหน่อย เพื่อทำให้หลัง login เสร็จแล้วจะทำการ redirect กลับมายังหน้าที่เรียกไป ขอก๊อปเนื้อหาจากเว็บที่ผมไปดูมาเลยละกันนะ ประมาณว่าแปลเป็นไทย (ขอบคุณ tutorial-phpbb3-mod-login-redirection) ไฟล์ที่เกี่ยวข้องมีดังต่อไปนี้ ucp.php includes/functions.php, styles/prosilver/template/overall_header.html มาดูกันทีละไฟล์เลยละกัน ทั้งหมดนี้เป็นการรับ parameter ด้วย method post จากหน้าที่ส่งข้อมูลมา ทำให้ phpBB สามารถ redirect ตัวเองกลับไปยัง page นั้นๆได้ครับ ucp.php 1. เปิดไฟล์ ucp.php ขึ้นมา 2. หาโค๊ดนี้ให้เจอครับ 1 2 3 4 5 6 [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>ต่อเนื่องจากเนื้อหาคราวก่อนในการ <a href="http://www.aspgod.com/?p=416">Login Integration</a> กับ phpBB นั้น หากเราไม่ต้องการทำอะไรเกี่ยวกับการ login/logout เลย ให้ใช้ระบบ login ของ phpBB โดยพลัน แต่ต้องทำการแก้โค๊ดนิดหน่อย เพื่อทำให้หลัง login เสร็จแล้วจะทำการ redirect กลับมายังหน้าที่เรียกไป<br />
<span id="more-442"></span></p>
<p>ขอก๊อปเนื้อหาจากเว็บที่ผมไปดูมาเลยละกันนะ ประมาณว่าแปลเป็นไทย (ขอบคุณ <a href="http://www.ozzu.com/php-tutorials/tutorial-phpbb3-mod-login-redirection-t90276.html">tutorial-phpbb3-mod-login-redirection</a>)</p>
<p><strong>ไฟล์ที่เกี่ยวข้องมีดังต่อไปนี้</strong><br />
ucp.php<br />
includes/functions.php,<br />
styles/prosilver/template/overall_header.html</p>
<p>มาดูกันทีละไฟล์เลยละกัน ทั้งหมดนี้เป็นการรับ parameter ด้วย method post จากหน้าที่ส่งข้อมูลมา ทำให้ phpBB สามารถ redirect ตัวเองกลับไปยัง page นั้นๆได้ครับ<br />
<span style="text-decoration: underline;"><strong>ucp.php</strong></span><br />
1. เปิดไฟล์ ucp.php ขึ้นมา<br />
2. หาโค๊ดนี้ให้เจอครับ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'&lt;span&gt;login&lt;/span&gt;'</span><span style="color: #339933;">:</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>data<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span>redirect<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span>append_sid<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$phpbb_root_path}</span>index.<span style="color: #006699; font-weight: bold;">$phpEx</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
login_box<span style="color: #009900;">&#40;</span>request_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span&gt;redirect&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;index.<span style="color: #006699; font-weight: bold;">$phpEx</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>3. ให้เอาโค๊ดด้านล่างนี้ไปทับ (replace)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'&lt;span&gt;login&lt;/span&gt;'</span><span style="color: #339933;">:</span>
$<span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span>redirect<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'from'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>data<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'is_registered'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: &quot;</span><span style="color: #339933;">.</span> append_sid<span style="color: #009900;">&#40;</span>$<span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span>redirect<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
login_box<span style="color: #009900;">&#40;</span>request_var<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span&gt;redirect&lt;/span&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;index.<span style="color: #006699; font-weight: bold;">$phpEx</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> append_sid<span style="color: #009900;">&#40;</span>$<span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span>redirect<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span style="text-decoration: underline;"><strong>includes/functions.php</strong></span><br />
1. เปิดไฟล์ functions.php ขึ้นมา (แก้ระวังๆนะครับ เป็น core กลางเลยหน้านี้)<br />
2. หาโค๊ดนี้ให้เจอ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'T_STYLESHEET_NAME'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">theme</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'theme_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span></pre></td></tr></table></div>

<p>3. วางโค๊ดนี้ไว้ด้านหลังครับ (add after)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'THIS_PAGE'</span>             <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">str_ireplace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&amp;amp;'</span><span style="color: #339933;">,</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></pre></td></tr></table></div>

<p>4. หาโค๊ดนี้ให้เจอ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> login_box<span style="color: #009900;">&#40;</span><span style="color: #000088;">$redirect</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l_explain</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l_success</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$admin</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s_display</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>5. เอาโค๊ดนี้ไปทับ (replace)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> login_box<span style="color: #009900;">&#40;</span><span style="color: #000088;">$redirect</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l_explain</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$l_success</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$admin</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s_display</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$redirect</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'./index.php'</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p><span style="text-decoration: underline;"><strong>styles/prosilver/template/overall_header.html</strong></span><br />
1. เปิดไฟล์ overall_header.html<br />
2. หาโค๊ดนี้ให้เจอ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span> <span style="color: #b1b100;">IF</span> S_DISPLAY_SEARCH and not S_IN_SEARCH <span style="color: #339933;">--&gt;</span>
            <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;search-box&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>form action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{U_SEARCH}&quot;</span> method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;search&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>fieldset<span style="color: #339933;">&gt;</span>
                    <span style="color: #339933;">&lt;</span>input name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;keywords&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;keywords&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> maxlength<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;128&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{L_SEARCH_KEYWORDS}&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;inputbox search&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;!-- IF SEARCH_WORDS--&gt;{SEARCH_WORDS}&lt;!-- ELSE --&gt;{L_SEARCH_MINI}&lt;!-- ENDIF --&gt;&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;if(this.value=='{LA_SEARCH_MINI}')this.value='';&quot;</span> onblur<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;if(this.value=='')this.value='{LA_SEARCH_MINI}';&quot;</span> <span style="color: #339933;">/&gt;</span>
                    <span style="color: #339933;">&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button2&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{L_SEARCH}&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> <span style="color: #339933;">/&gt;&lt;</span>br <span style="color: #339933;">/&gt;</span>
                    <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{U_SEARCH}&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{L_SEARCH_ADV_EXPLAIN}&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#123;</span>L_SEARCH_ADV<span style="color: #009900;">&#125;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span>S_SEARCH_HIDDEN_FIELDS<span style="color: #009900;">&#125;</span>
                <span style="color: #339933;">&lt;/</span>fieldset<span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>3. จากนั้นเอาโค๊ดนี้ไว้ข้างหลัง (add after)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span> <span style="color: #b1b100;">IF</span> not S_USER_LOGGED_IN and not S_IS_BOT <span style="color: #339933;">--&gt;</span>
                <span style="color: #339933;">&lt;</span>form method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{S_LOGIN_ACTION}&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;headerspace&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
                    <span style="color: #339933;">&lt;</span>fieldset <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;quick-login&quot;</span><span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;from&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{THIS_PAGE}&quot;</span> <span style="color: #339933;">/&gt;</span>
                        <span style="color: #339933;">&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;username2&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#123;</span>L_USERNAME<span style="color: #009900;">&#125;</span><span style="color: #339933;">:&lt;/</span>label<span style="color: #339933;">&gt;&amp;</span>nbsp<span style="color: #339933;">;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;username&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;username2&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;20&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;inputbox&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{L_USERNAME}&quot;</span> <span style="color: #339933;">/&gt;&lt;</span>br <span style="color: #339933;">/&gt;</span>
                        <span style="color: #339933;">&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;password2&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#123;</span>L_PASSWORD<span style="color: #009900;">&#125;</span><span style="color: #339933;">:&lt;/</span>label<span style="color: #339933;">&gt;&amp;</span>nbsp<span style="color: #339933;">;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;password&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;password&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;password2&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;20&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;inputbox&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{L_PASSWORD}&quot;</span> <span style="color: #339933;">/&gt;&lt;</span>br <span style="color: #339933;">/&gt;</span>
                        <span style="color: #339933;">&lt;!--</span> <span style="color: #b1b100;">IF</span> S_AUTOLOGIN_ENABLED <span style="color: #339933;">--&gt;</span>
                        <span style="color: #339933;">&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;autologin2&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#123;</span>L_LOG_ME_IN<span style="color: #009900;">&#125;</span> <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;autologin&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;autologin2&quot;</span> <span style="color: #339933;">/&gt;&lt;/</span>label<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;!--</span> <span style="color: #b1b100;">ENDIF</span> <span style="color: #339933;">--&gt;</span>
                        <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;login&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{L_LOGIN}&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button2&quot;</span> <span style="color: #339933;">/&gt;</span>
                    <span style="color: #339933;">&lt;/</span>fieldset<span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;!--</span> <span style="color: #b1b100;">ENDIF</span> <span style="color: #339933;">--&gt;</span></pre></td></tr></table></div>

<p>นี่เป็นการแก้ไขในส่วนของ phpBB หลังจากนี้เป็นตัวส่งข้อมูลไปยังหน้า ucp.php ส่งด้วย method post ใช้ code ง่ายๆตามนี้ครับ เป็นแค่ปุ่มๆเดียวในการ link ไปหาหน้า login ของ phpBB นั้นๆ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>form action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://aspgod.com/ucp.php?mode=login&quot;</span> method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;from&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://aspgod.com&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;LogIn&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>เมื่อกดปุ่มแล้วก็จะ ไปยังหน้า login เมื่อ login เสร็จก็จะกลับมายังหน้าเดิมตาม value ที่ส่งไป<br />
*** ต้องส่งด้วยชื่อ paramerter ว่า &#8220;from&#8221; เท่านั้นนะครับ เพราะเซ็ตให้เป็นแบบนั้น</p>
<p>สำหรับใครที่ต้องการให้ login เสร็จแล้ววิ่งไปยัง domain name อื่น (cross domain) โดย default แล้ว phpBB ไม่อนุญาตให้ redirect ไปยัง domain อื่น ดังนั้นเราต้องแก้เพิ่มอีกนิดหน่อย (อันนี้ผมหาเจอเองนะ ขอ credit หน่อยละกัน อิอิ)<br />
1. เปิดไฟล์ includes/functions.php ขึ้นมา<br />
2. หาโค๊ดนี้ในไฟล์</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$redirect</span> <span style="color: #339933;">=</span> meta_refresh<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #000088;">$redirect</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>3. เอาโค๊ดนี้ไปทับ (replace) จริงๆเป็นการเพิ่ม parameter</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$redirect</span> <span style="color: #339933;">=</span> meta_refresh<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #000088;">$redirect</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>เป็นการทำให้ redirect โดยไม่สนใจ root domain</p>
<p>ก็เป็นด้วยประการฉะนี้แล หวังว่าข้อมูลนี้จะเป็นประโยชน์ไม่มากก็น้อยนะครับ</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/phpbb/phpbb-login-and-redirect-with-modifying-code.html/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>phpBB login integration การ login โดยใช้ user phpBB</title>
		<link>http://www.aspgod.com/phpbb/phpbb-login-integration-%e0%b8%81%e0%b8%b2%e0%b8%a3-login-%e0%b9%82%e0%b8%94%e0%b8%a2%e0%b9%83%e0%b8%8a%e0%b9%89-user-phpbb.html</link>
		<comments>http://www.aspgod.com/phpbb/phpbb-login-integration-%e0%b8%81%e0%b8%b2%e0%b8%a3-login-%e0%b9%82%e0%b8%94%e0%b8%a2%e0%b9%83%e0%b8%8a%e0%b9%89-user-phpbb.html#comments</comments>
		<pubDate>Thu, 04 Mar 2010 16:35:38 +0000</pubDate>
		<dc:creator>aspgod</dc:creator>
				<category><![CDATA[phpBB]]></category>
		<category><![CDATA[Login Integration]]></category>
		<category><![CDATA[member]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[webboard]]></category>

		<guid isPermaLink="false">http://www.aspgod.com/?p=416</guid>
		<description><![CDATA[หลายคนคงสงสัยว่าจะ login โดยใช้ member ของ webboard phpBB ได้ยังไง เชื่อได้ว่าทุกคนที่ต้องการทำเว็บก็ต้องการทำระบบ member กันแทบทั้งสิ้น หากเราใช้ member ของ phpBB แล้วเราจะเขียนติดต่อกับมันได้อย่างไร ลองมาดูคลิป youtube นี้ดูแล้วกันครับ มีทั้ง login, logout และการ verify username/password ด้วย ผมได้ทดสอบด้วยตัวเองแล้วครับ จริงๆแล้วไม่จำเป็นต้อง comment โค๊ดด้านล่างนี้ออกจาก functions.php (ในกรณีที่ไม่ต้องการวางไฟล์ต่างๆไว้ใน path เดียวกับ phpBB) 1 2 3 4 if &#40;!defined&#40;'IN_PHPBB'&#41;&#41; &#123; exit; &#125; เพียงแค่เราใส่โค๊ดด้านล่างที่ไฟล์ login.php ก็ทำให้สามารถใช้ function ต่างๆใน functions.php ได้แล้วครับ 1 define&#40;'IN_PHPBB', true&#41;; สุดท้ายนี้ [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>หลายคนคงสงสัยว่าจะ login โดยใช้ member ของ webboard phpBB ได้ยังไง เชื่อได้ว่าทุกคนที่ต้องการทำเว็บก็ต้องการทำระบบ member กันแทบทั้งสิ้น หากเราใช้ member ของ phpBB แล้วเราจะเขียนติดต่อกับมันได้อย่างไร ลองมาดูคลิป youtube นี้ดูแล้วกันครับ มีทั้ง login, logout และการ verify username/password ด้วย</p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/Jq4csat4jNU&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Jq4csat4jNU&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="540" height="385"></embed></object></p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/XIs7Y3p10Hg&#038;hl=en_US&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/XIs7Y3p10Hg&#038;hl=en_US&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="540" height="385"></embed></object></p>
<p>ผมได้ทดสอบด้วยตัวเองแล้วครับ จริงๆแล้วไม่จำเป็นต้อง comment โค๊ดด้านล่างนี้ออกจาก functions.php (ในกรณีที่ไม่ต้องการวางไฟล์ต่างๆไว้ใน path เดียวกับ phpBB)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IN_PHPBB'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>เพียงแค่เราใส่โค๊ดด้านล่างที่ไฟล์ login.php ก็ทำให้สามารถใช้ function ต่างๆใน functions.php ได้แล้วครับ</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IN_PHPBB'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>สุดท้ายนี้ สำหรับคนที่ไม่อยากดูคลิปให้จบล่ะก็ ผมได้ upload <a href='http://www.aspgod.com/wp-content/uploads/2010/03/phpBB_login_integration_code.zip'>phpBB_login_integration_code</a> ไว้ให้แล้วครับ หวังว่าคงอ่านเข้าใจนะ ^ ^ </p>
<p>ที่กล่าวมาทั้งหมด เป็นการใช้ประโยชน์จาก member ของ phpbb เท่านั้นครับ ไม่รวมถึงการที่ใช้สถานะ login ร่วมกัน<br />
hope you enjoy with this article.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.aspgod.com/phpbb/phpbb-login-integration-%e0%b8%81%e0%b8%b2%e0%b8%a3-login-%e0%b9%82%e0%b8%94%e0%b8%a2%e0%b9%83%e0%b8%8a%e0%b9%89-user-phpbb.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

