<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — Absolute paths break cookies]]></title>
		<link>https://punbb.informer.com/forums/topic/10224/absolute-paths-break-cookies/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/10224/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Absolute paths break cookies.]]></description>
		<lastBuildDate>Mon, 23 Jan 2006 16:15:38 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Absolute paths break cookies]]></title>
			<link>https://punbb.informer.com/forums/post/60920/#p60920</link>
			<description><![CDATA[<p>Gotcha. I guess in that case the best thing to do is just pull the piece of extern.php you want as a regular function on your site and skip the include route. That&#039;s what I&#039;ll probably do at some point as well.</p>]]></description>
			<author><![CDATA[null@example.com (ontap)]]></author>
			<pubDate>Mon, 23 Jan 2006 16:15:38 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60920/#p60920</guid>
		</item>
		<item>
			<title><![CDATA[Re: Absolute paths break cookies]]></title>
			<link>https://punbb.informer.com/forums/post/60872/#p60872</link>
			<description><![CDATA[<p>That&#039;s a bit of a letdown. Thanks, Smartys.</p><div class="quotebox"><cite>ontap wrote:</cite><blockquote><p>That&#039;s what I was wondering -- if someone could somehow take advantage of this set up. I couldn&#039;t figure out exactly how you would do it though, since to the outside world you wouldn&#039;t have any way (or would you?) of knowing that this was pulling from a PunBB include.</p></blockquote></div><p>Not unless I&#039;m missing something. I just feel a little nervous about admin functions being available to anyone through a carefully written URL, even a hidden one.</p>]]></description>
			<author><![CDATA[null@example.com (Mastodon)]]></author>
			<pubDate>Mon, 23 Jan 2006 02:23:34 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60872/#p60872</guid>
		</item>
		<item>
			<title><![CDATA[Re: Absolute paths break cookies]]></title>
			<link>https://punbb.informer.com/forums/post/60867/#p60867</link>
			<description><![CDATA[<p><a href="http://us2.php.net/manual/en/function.include.php">http://us2.php.net/manual/en/function.include.php</a></p><p>Take a look at &quot;Example 16-7. include() through HTTP&quot;</p><p>There isn&#039;t a way around that <img src="https://punbb.informer.com/forums/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[null@example.com (Smartys)]]></author>
			<pubDate>Sun, 22 Jan 2006 23:18:19 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60867/#p60867</guid>
		</item>
		<item>
			<title><![CDATA[Re: Absolute paths break cookies]]></title>
			<link>https://punbb.informer.com/forums/post/60848/#p60848</link>
			<description><![CDATA[<p>That&#039;s what I was wondering -- if someone could somehow take advantage of this set up. I couldn&#039;t figure out exactly how you would do it though, since to the outside world you wouldn&#039;t have any way (or would you?) of knowing that this was pulling from a PunBB include. On my particular setup I made a few mods to the extern file so that news on my front page jumps to dedicated pages for those topics, not back to the boards -- basically just using a staff only Forum in the boards as a quick and easy way to post to other sections of the site. So if we&#039;ve got a particular event, we can post a notice on the front page that jumps to <a href="http://www.mysite.com/event_name,">www.mysite.com/event_name,</a> which displays that main page post plus any other posts from that Forum.</p>]]></description>
			<author><![CDATA[null@example.com (ontap)]]></author>
			<pubDate>Sun, 22 Jan 2006 18:26:58 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60848/#p60848</guid>
		</item>
		<item>
			<title><![CDATA[Re: Absolute paths break cookies]]></title>
			<link>https://punbb.informer.com/forums/post/60839/#p60839</link>
			<description><![CDATA[<p>Thanks for the tremendous reply. I think I&#039;m going to split up my files instead, to avoid using $_GET variables -- your method seems a little insecure. An enterprising member (or even a guest) could easily make himself an admin from the perspective of the included page if he knew what he was doing.</p><p>What we really need is for someone to shed some light on <em>why</em> pages aren&#039;t being found with URL variables. Perhaps it&#039;s a common mistake on our part.</p>]]></description>
			<author><![CDATA[null@example.com (Mastodon)]]></author>
			<pubDate>Sun, 22 Jan 2006 17:00:38 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60839/#p60839</guid>
		</item>
		<item>
			<title><![CDATA[Re: Absolute paths break cookies]]></title>
			<link>https://punbb.informer.com/forums/post/60799/#p60799</link>
			<description><![CDATA[<p>I&#039;ve been battling the same problem all day. Finally came up with a workaround -- probably not the best or most efficient way to do this but it will solve the problem.</p><p>Like you, I found that if I try to include extern.php with a relative path (ie: include&quot;/forums/extern.php?action=news&quot;) it always failed. If I took off the query part (everything after the ?) it would pull the file but obviously show no results. If I use the absolute path (include&quot;http://www.mysite.com/boards/extern.php etc.&quot;) then all is good... except that the global $pun_user info. isn&#039;t available to extern.php and neither is the cookie info. I wanted to be able to use that info. to conditionally display info. via extern.php -- like only showing the number of times a certain post has been viewed to admins and staff, not all visitors.</p><p>So, here&#039;s what I ended up doing:</p><p>In the calling page, for example index.php, I added the following lines to turn the $pun_user array into two strings, one with the names of each variable (like username, group_id) and one with the associated values (like joeblow, 2):<br />$keys=array_keys($pun_user);<br />$keys=implode(&quot;,&quot;,$keys);<br />$pun_user = implode(&quot;,&quot;,$pun_user);<br />$append = &quot;&amp;keys=&quot;.$keys.&quot;&amp;pun_user=&quot;.$pun_user;</p><p>Then I pass that info. to extern.php by tagging $append onto the include like so:<br />include &quot;<a href="http://www.mysite.com/forums/extern.php?action=news&amp;summary=2&amp;fid=14">http://www.mysite.com/forums/extern.php … amp;fid=14</a>&quot;.$append;</p><p>Then I added some lines in extern.php to convert that info. back into the $pun_user array so that I can access them just like anywhere else.</p><p>$a=&quot;&quot;;<br />$b=&quot;&quot;;<br />$values=&quot;&quot;;<br />if(isset($_GET[&#039;keys&#039;])) $a = $_GET[&#039;keys&#039;]; <br />if(isset($_GET[&#039;pun_user&#039;])) $b = $_GET[&#039;pun_user&#039;]; <br />$a = explode (&quot;,&quot;,$a);<br />$b = explode (&quot;,&quot;,$b);<br />$num_var=count($b);<br />$c=array_chunk($a, $num_var);<br />$a=$c[&#039;0&#039;];<br />$keys=array_values($a);<br />$values=array_values($b);<br />$pun_user = array();<br />for ($i = 0; $i &lt; $num_var; $i++) {<br />$pun_user[$keys[$i]] = $values[$i]; }</p><p>What I&#039;m doing here is first setting the variables we&#039;re going to use and checking to see if we have passed the $append info. (you might have instances of extern.php where you don&#039;t need that info. and this will prevent you from getting errors because extern.php is expecting $append). <br />$a=&quot;&quot;;<br />$b=&quot;&quot;;<br />$values=&quot;&quot;;<br />if(isset($_GET[&#039;keys&#039;])) $a = $_GET[&#039;keys&#039;]; <br />if(isset($_GET[&#039;pun_user&#039;])) $b = $_GET[&#039;pun_user&#039;];</p><p>If $keys and $pun_user are set, I then turn them back into arrays via the explode() function. <br />$a = explode (&quot;,&quot;,$a);<br />$b = explode (&quot;,&quot;,$b);</p><p>Unless all of your users have filled out every possible field of user info. you&#039;re always going to end up with more field keys than field info -- as in, I didn&#039;t put in any IM or ICQ info. so those field names will be in the $keys array but will have no corresponding value in the $pun_user array. So I count the array that has your user values ($b) and then use the array_chunk() function to cut the $keys array to the same size:<br />$num_var=count($b);<br />$c=array_chunk($a, $num_var);<br />$a=$c[&#039;0&#039;];</p><p>Finally, I&#039;m using PHP4 so I don&#039;t have the array_combine() function available so the next lines were my workaround. Basically I just do a loop to add values to the array $pun_user. <br />$keys=array_values($a);<br />$values=array_values($b);<br />$pun_user = array();<br />for ($i = 0; $i &lt; $num_var; $i++) {<br />$pun_user[$keys[$i]] = $values[$i]; }</p><p>There you go. Probably not the most elegant way to handle this and I don&#039;t know if there are any security implications (you are passing all of this info. via a $_GET), but it&#039;s working for me. After that access any of the $pun_user variables within extern.php just like you use them elsewhere.</p>]]></description>
			<author><![CDATA[null@example.com (ontap)]]></author>
			<pubDate>Sun, 22 Jan 2006 02:23:24 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60799/#p60799</guid>
		</item>
		<item>
			<title><![CDATA[Absolute paths break cookies]]></title>
			<link>https://punbb.informer.com/forums/post/60692/#p60692</link>
			<description><![CDATA[<p>Hello,</p><p>I&#039;m currently working on building a website off of PunBB 1.2.10. However, because relative paths across the /forum folder and others don&#039;t seem to want to cooperate on including pages with variables being passed through the URL (&quot;include &#039;rightbar.php&#039;;&quot; works fine, &quot;include &#039;rightbar.php?pg=index&#039;;&quot; does not, but get this: &quot;include &#039;<a href="http://www.domain.com/rightbar.php?pg=index">http://www.domain.com/rightbar.php?pg=index</a>&#039;;&quot; does the trick), I&#039;ve given up and begun to use absolute paths (starting from &quot;http://&quot;). The problem here is that this method of includes seems to break cookie reading. Directly reading the pages will produce the right information, but including them from another page using a full URL will make me appear as a guest.</p><p>Is there anything I can do to read cookies from pages with absolute URLs, or will I be forced to stop using URL variables in included pages altogether?</p><p>P.S. I&#039;ve tried the &quot;base&quot; header tag, but it didn&#039;t fix the problem.</p>]]></description>
			<author><![CDATA[null@example.com (Mastodon)]]></author>
			<pubDate>Fri, 20 Jan 2006 14:50:10 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/60692/#p60692</guid>
		</item>
	</channel>
</rss>
