<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[TNF : Tatter Network Foundation forum - session_start 함수를 rewrite.php 에 넣고싶은데...]]></title>
		<link>http://forum.tattersite.com/ko/viewtopic.php?id=6107</link>
		<description><![CDATA[session_start 함수를 rewrite.php 에 넣고싶은데... 의 최근 RSS 글들.]]></description>
		<lastBuildDate>Wed, 09 Jul 2008 06:32:03 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[RSS 답글: session_start 함수를 rewrite.php 에 넣고싶은데...]]></title>
			<link>http://forum.tattersite.com/ko/viewtopic.php?pid=28885#p28885</link>
			<description><![CDATA[<p>pass.php</p><p>&lt;? <br />function movepage($url,$msg=&quot;&quot;){<br />&nbsp; &nbsp; echo &quot;&lt;script&gt;&quot;; <br />&nbsp; &nbsp; if($msg) echo &quot;alert(&#039;$msg&#039;);&quot;;<br />&nbsp; &nbsp; if($url==&quot;history.go(-1)&quot;){<br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;history.go(-1);&quot;;<br />&nbsp; &nbsp; }else{ <br />&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;location.replace(&#039;$url&#039;);&quot;;<br />&nbsp; &nbsp; } <br />&nbsp; &nbsp; echo &quot;&lt;/script&gt;&quot;;<br />&nbsp; &nbsp; exit;<br />} <br />header (&quot;P3P : CP=\&quot;ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC\&quot;&quot;);<br />session_start();</p><p>// 보안 필터링 <br />if(!eregi(getenv(&quot;HTTP_HOST&quot;),getenv(&quot;HTTP_REFERER&quot;),getenv(&quot;HTTP_GET&quot;))) movepage(&quot;history.go(-1)&quot;,&quot;정상적으로 접근하여주세요.&quot;);</p><p>// 정상적 절차로 왔을경우, 새션을 구워주세요... <br />if(!$_SESSION[cookie]) {<br />&nbsp; &nbsp; $_SESSION[cookie]=7;<br />&nbsp; &nbsp; $session_id = substr($_SESSION[session_id],1); // 0.5 으로 끊어서 0.5 + 0.5 = 1값으로...<br />} <br />movepage(&quot;./../tc/index.php&quot;);<br />?&gt;</p><p>/tc/lib/session.php 에 다음과 같이 넣었는데 가능할까요?</p><p>function setSession() {<br />&nbsp; &nbsp; if( !empty($_GET[&#039;TSSESSION&#039;]) ) {<br />&nbsp; &nbsp; &nbsp; &nbsp; $id = $_GET[&#039;TSSESSION&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; $_COOKIE[session_name()] = $id;<br />&nbsp; &nbsp; } else if ( !empty($_COOKIE[session_name()]) ) {<br />&nbsp; &nbsp; &nbsp; &nbsp; $id = $_COOKIE[session_name()];<br />&nbsp; &nbsp; &nbsp; &nbsp; $cookie = $_SESSION[cookie];&nbsp; &nbsp; //pass.php<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; $id = &#039;&#039;;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; if ((strlen($id) &lt; 32) || !isSessionAuthorized($id)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; setSessionAnonymous($id);<br />&nbsp; &nbsp; &nbsp; &nbsp; setSessionAnonymous($cookie);&nbsp; &nbsp; //pass.php<br />&nbsp; &nbsp; }<br />}</p>]]></description>
			<author><![CDATA[null@example.com (크리스토옵)]]></author>
			<pubDate>Wed, 09 Jul 2008 06:32:03 +0000</pubDate>
			<guid>http://forum.tattersite.com/ko/viewtopic.php?pid=28885#p28885</guid>
		</item>
		<item>
			<title><![CDATA[RSS 답글: session_start 함수를 rewrite.php 에 넣고싶은데...]]></title>
			<link>http://forum.tattersite.com/ko/viewtopic.php?pid=28866#p28866</link>
			<description><![CDATA[<p>음, 질문을 한데 모아놓으니 이제서야 무엇을 하시려는 건지 대충 알 것 같군요..;; 기왕이면 질문을 올려주실 때 포럼의 특성(?)을 활용해서 첫 쓰레드에 계속 추가하는 식으로 올려주시면 한 눈에 의도 파악도 되고 좋을 것 같네요.<br />(그러고보니 질문답변 포럼은 &#039;게시판&#039;처럼 운영하고 있군요..음-_-)</p><p>그러니까 하시려는 게 블로그를 보려면 인증 절차를 한 단계 두고 싶다는 것인데, 그 인증 절차가 굳이 매우 특별한 형식이 아닌 이상 텍스트큐브 자체의 블로그 공개 설정 기능을 이용하시는 것이 가장 나을 것 같습니다. 만약 예전에 올리셨던 질문 중에 pass.php를 <strong>반드시</strong> 써야 한다면 거기서 인증 결과를 해시 등으로 생성해서 쿠키로 구우신 다음 텍스트큐브의 rewrite.php 같은 곳에서 체크하면 되지 않을까요?</p><p>예를 들면 pass.php에서 통과가 되면 key를 생성하고 그 key를 DB에 저장 + 쿠키로 설정한 다음 텍스트큐브로 redirect 시켜서 rewrite.php에서 해당 key와 DB에 저장이 된 게 일치하는지 확인한다든지 말이죠. 좀더 안전하게 하려면 timestamp를 넣어 시간 제한을 하거나 무한히 key가 쌓이는 걸 방지할 수도 있겠구요. (그러니까 php에서 하는 session 관리를 간단하게 직접 구현하는 것도 한 방법이라는 얘깁니다. 말씀하신 상황으로 봐선 php 자체의 세션 관리와 텍스트큐브의 세션이 충돌하는 것 같아서요.)</p>]]></description>
			<author><![CDATA[null@example.com (daybreaker)]]></author>
			<pubDate>Tue, 08 Jul 2008 04:22:48 +0000</pubDate>
			<guid>http://forum.tattersite.com/ko/viewtopic.php?pid=28866#p28866</guid>
		</item>
		<item>
			<title><![CDATA[RSS 답글: session_start 함수를 rewrite.php 에 넣고싶은데...]]></title>
			<link>http://forum.tattersite.com/ko/viewtopic.php?pid=28861#p28861</link>
			<description><![CDATA[<p>^^; 조금 과감하셨습니다. creorix님.. <img src="http://forum.tattersite.com/ko/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>궁극적으로 원하시는 기능이 다른 기능과의 세션 변수 연동인가요?<br />세션관리에 대한 것은<br /><a href="http://dev.textcube.org/wiki/SessionManagement">http://dev.textcube.org/wiki/SessionManagement</a><br />링크를 참조하시고 연동에 대한 좀더 구체적인 것을 얘기해주시면 다른 방향으로 가이드를 만들어 보겠습니다.</p>]]></description>
			<author><![CDATA[null@example.com (coolengineer)]]></author>
			<pubDate>Mon, 07 Jul 2008 16:15:09 +0000</pubDate>
			<guid>http://forum.tattersite.com/ko/viewtopic.php?pid=28861#p28861</guid>
		</item>
		<item>
			<title><![CDATA[RSS 답글: session_start 함수를 rewrite.php 에 넣고싶은데...]]></title>
			<link>http://forum.tattersite.com/ko/viewtopic.php?pid=28859#p28859</link>
			<description><![CDATA[<p>너무 과감하게 말씀하시는거같으시네요 ㅜㅜ</p>]]></description>
			<author><![CDATA[null@example.com (크리스토옵)]]></author>
			<pubDate>Mon, 07 Jul 2008 13:52:19 +0000</pubDate>
			<guid>http://forum.tattersite.com/ko/viewtopic.php?pid=28859#p28859</guid>
		</item>
		<item>
			<title><![CDATA[session_start 함수를 rewrite.php 에 넣고싶은데...]]></title>
			<link>http://forum.tattersite.com/ko/viewtopic.php?pid=28856#p28856</link>
			<description><![CDATA[<p>rewrite.php // 소스...</p><p>&lt;? session_start(); ?&gt;<br />&lt;?php<br />&nbsp; &nbsp; define(&#039;ROOT&#039;, &#039;.&#039;); <br />&nbsp; &nbsp; /* Workaround for IIS environment */<br />&nbsp; &nbsp; if(!isset($_SERVER[&#039;REQUEST_URI&#039;]) &amp;&amp; isset($_SERVER[&#039;SCRIPT_NAME&#039;])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; $_SERVER[&#039;REQUEST_URI&#039;] = $_SERVER[&#039;SCRIPT_NAME&#039;];<br />&nbsp; &nbsp; &nbsp; &nbsp; if(isset($_SERVER[&#039;QUERY_STRING&#039;]) &amp;&amp; !empty($_SERVER[&#039;QUERY_STRING&#039;])) $_SERVER[&#039;REQUEST_URI&#039;] .= &#039;?&#039;.$_SERVER[&#039;QUERY_STRING&#039;];<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; if (!empty($_SERVER[&#039;PRELOAD_CONFIG&#039;]) &amp;&amp; file_exists(&#039;config.php&#039;)) require_once ROOT.&quot;/config.php&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; /* Retrieve Access Parameter Information. */<br />&nbsp; &nbsp; $accessInfo = array(<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;host&#039;&nbsp; &nbsp; &nbsp;=&gt; $_SERVER[&#039;HTTP_HOST&#039;],<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;fullpath&#039; =&gt; str_replace(&#039;index.php&#039;, &#039;&#039;, $_SERVER[&quot;REQUEST_URI&quot;]),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;position&#039; =&gt; $_SERVER[&quot;SCRIPT_NAME&quot;],<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;root&#039;&nbsp; &nbsp; &nbsp;=&gt; rtrim(str_replace(&#039;rewrite.php&#039;, &#039;&#039;, $_SERVER[&quot;SCRIPT_NAME&quot;]), &#039;index.php&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; );<br />&nbsp; &nbsp; if (strpos($accessInfo[&#039;fullpath&#039;],$accessInfo[&#039;root&#039;]) !== 0)<br />&nbsp; &nbsp; &nbsp; &nbsp; $accessInfo[&#039;fullpath&#039;] = $accessInfo[&#039;root&#039;].substr($accessInfo[&#039;fullpath&#039;], strlen($accessInfo[&#039;root&#039;]) - 1);<br />&nbsp; &nbsp; // Workaround for compartibility with fastCGI / Other environment<br />&nbsp; &nbsp; $accessInfo[&#039;input&#039;] = ltrim(substr($accessInfo[&#039;fullpath&#039;],<br />&nbsp; &nbsp; &nbsp; &nbsp; strlen($accessInfo[&#039;root&#039;]) + (defined(&#039;__TEXTCUBE_NO_FANCY_URL__&#039;) ? 1 : 0)),&#039;/&#039;);<br />&nbsp; &nbsp; // Support Tattertools 0.9x legacy address (for upgrade users)<br />&nbsp; &nbsp; if (array_key_exists(&#039;pl&#039;, $_GET) &amp;&amp; strval(intval($_GET[&#039;pl&#039;])) == $_GET[&#039;pl&#039;]) { header(&quot;Location: &quot;.$accessInfo[&#039;root&#039;].$_GET[&#039;pl&#039;]); exit;}<br />&nbsp; &nbsp; $part = strtok($accessInfo[&#039;input&#039;], &#039;/&#039;);<br />&nbsp; &nbsp; if (in_array($part, array(&#039;image&#039;,&#039;plugins&#039;,&#039;script&#039;,&#039;cache&#039;,&#039;skin&#039;,&#039;style&#039;,&#039;attach&#039;,&#039;thumbnail&#039;))) {<br />&nbsp; &nbsp; &nbsp; &nbsp; $part = ltrim(rtrim($part == &#039;thumbnail&#039; ?<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; preg_replace(&#039;/thumbnail/&#039;, &#039;cache/thumbnail&#039;, $accessInfo[&#039;input&#039;], 1) :<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $accessInfo[&#039;input&#039;]), &#039;/&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; if(file_exists($part)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; require_once ROOT.&#039;/lib/function/file.php&#039;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dumpWithEtag($part);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit;<br />&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; header(&quot;HTTP/1.0 404 Not Found&quot;);exit;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; if (strtok($part, &#039;?&#039;) == &#039;setup.php&#039;) {require &#039;setup.php&#039;; exit;}<br />&nbsp; &nbsp; $accessInfo[&#039;URLfragment&#039;] = explode(&#039;/&#039;,strtok($accessInfo[&#039;input&#039;],&#039;?&#039;));<br />&nbsp; &nbsp; unset($part);<br />&nbsp; &nbsp; @session_start();<br />&nbsp; &nbsp; /* Check the existence of config.php (whether installed or not) */<br />&nbsp; &nbsp; if (!file_exists(&#039;config.php&#039;)) {<br />&nbsp; &nbsp; &nbsp; &nbsp; if (file_exists(&#039;.htaccess&#039;)) {print &quot;&lt;html&gt;&lt;body&gt;Remove &#039;.htaccess&#039; file first!&lt;/body&gt;&lt;/html&gt;&quot;;exit;}<br />&nbsp; &nbsp; &nbsp; &nbsp; print &quot;&lt;html&gt;&lt;body&gt;&lt;a id=&#039;setup&#039; href=&#039;&quot;.rtrim($_SERVER[&quot;REQUEST_URI&quot;],&quot;/&quot;).&quot;/setup.php&#039;&gt;Click to setup.&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;&quot;;exit;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; /* Determine that which interface should be loaded. */<br />&nbsp; &nbsp; require_once &#039;config.php&#039;;<br />&nbsp; &nbsp; if(defined(&#039;__TEXTCUBE_NO_FANCY_URL__&#039;)) $service[&#039;type&#039;] = &#039;single&#039;;<br />&nbsp; &nbsp; switch ($service[&#039;type&#039;]) {<br />&nbsp; &nbsp; &nbsp; &nbsp; case &#039;path&#039;: // For path-based multi blog.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array_splice($accessInfo[&#039;URLfragment&#039;],0,1); <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $pathPart = ltrim(rtrim(strtok(strstr($accessInfo[&#039;input&#039;],&#039;/&#039;), &#039;?&#039;), &#039;/&#039;), &#039;/&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp; &nbsp; &nbsp; case &#039;single&#039;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $pathPart = (strpos($accessInfo[&#039;input&#039;],&#039;?&#039;) !== 0 ? ltrim(rtrim(strtok($accessInfo[&#039;input&#039;], &#039;?&#039;), &#039;/&#039;), &#039;/&#039;) : &#039;&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp; &nbsp; &nbsp; case &#039;domain&#039;: default: <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $pathPart = ltrim(rtrim(strtok($accessInfo[&#039;fullpath&#039;], &#039;?&#039;), &#039;/&#039;), &#039;/&#039;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!empty($service[&#039;path&#039;])) $pathPart = ltrim($pathPart,$service[&#039;path&#039;]);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; $pathPart = strtok($pathPart,&#039;&amp;&#039;);<br />&nbsp; &nbsp; /* Load interface. */<br />&nbsp; &nbsp; $interfacePath = null;<br />&nbsp; &nbsp; if (in_array($pathPart, array(&#039;favicon.ico&#039;,&#039;index.gif&#039;))) {require_once &#039;interface/&#039;.$pathPart.&#039;.php&#039;;&nbsp; &nbsp; exit;}<br />&nbsp; &nbsp; if (!empty($accessInfo[&#039;URLfragment&#039;]) &amp;&amp;<br />&nbsp; &nbsp; &nbsp; &nbsp; in_array($accessInfo[&#039;URLfragment&#039;][0],<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;array(&#039;api&#039;,&#039;archive&#039;,&#039;attachment&#039;,&#039;author&#039;,&#039;category&#039;,&#039;checkup&#039;,&#039;cover&#039;,&#039;cron&#039;,&#039;entry&#039;,&#039;feeder&#039;,&#039;foaf&#039;,&#039;guestbook&#039;,&#039;keylog&#039;,&#039;location&#039;,&#039;logout&#039;,&#039;notice&#039;,&#039;page&#039;,&#039;plugin&#039;,&#039;pluginForOwner&#039;,&#039;search&#039;,&#039;suggest&#039;,&#039;sync&#039;,&#039;tag&#039;,&#039;ttxml&#039;)))<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; $pathPart = $accessInfo[&#039;URLfragment&#039;][0];<br />&nbsp; &nbsp; &nbsp; &nbsp; $interfacePath = &#039;interface/blog/&#039;.$pathPart.&#039;.php&#039;;<br />&nbsp; &nbsp; } else if (is_numeric(strtok(end($accessInfo[&#039;URLfragment&#039;]), &#039;&amp;&#039;))) {<br />&nbsp; &nbsp; &nbsp; &nbsp; $pathPart = count($accessInfo[&#039;URLfragment&#039;])==1 ? null : implode(&#039;/&#039;, array_slice($accessInfo[&#039;URLfragment&#039;], 0, count($accessInfo[&#039;URLfragment&#039;]) - 1));<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; if (empty($interfacePath)) $interfacePath = &#039;interface/&#039;.(empty($pathPart) ? &#039;&#039; : $pathPart.&#039;/&#039;).&#039;index.php&#039;;<br />&nbsp; &nbsp; define(&#039;PATH&#039;, &#039;interface/&#039;.(empty($pathPart) ? &#039;&#039; : $pathPart.&#039;/&#039;));<br />&nbsp; &nbsp; unset($pathPart);<br />&nbsp; &nbsp; if (!file_exists($interfacePath)) { require &quot;lib/error.php&quot;;errorExit(404);}<br />&nbsp; &nbsp; if (empty($service[&#039;debugmode&#039;])) {&nbsp; &nbsp; @include_once $interfacePath;}<br />&nbsp; &nbsp; else {include_once $interfacePath;}<br />?&gt;</p><p>맨윗줄에, 절대 변수 세션 &lt;? session_start(); ?&gt; 을 넣으니깐, 제가만든 인증세션은 작동하는데,</p><p>텍스터큐브 의 관리자 로그인이나, 메뉴 하이퍼링크를 클릭하면, 기능들이 죽어버립니다. 안된다는거죠...</p><p>&lt;? session_start(); ?&gt; 을 넣고싶은데, 어데다가 넣으면 좋을까요?</p><p>세션 절대함수를 넣으니깐, 로그인페이지에서 로그인이 안되네요...</p>]]></description>
			<author><![CDATA[null@example.com (크리스토옵)]]></author>
			<pubDate>Mon, 07 Jul 2008 10:35:35 +0000</pubDate>
			<guid>http://forum.tattersite.com/ko/viewtopic.php?pid=28856#p28856</guid>
		</item>
	</channel>
</rss>
