<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — base URL, intranet only and limited external access]]></title>
		<link>https://punbb.informer.com/forums/topic/18076/base-url-intranet-only-and-limited-external-access/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/18076/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in base URL, intranet only and limited external access.]]></description>
		<lastBuildDate>Tue, 22 Jan 2008 20:51:00 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: base URL, intranet only and limited external access]]></title>
			<link>https://punbb.informer.com/forums/post/107469/#p107469</link>
			<description><![CDATA[<p>Thanks elbeko, as you anticipated, it works fine as long as you don&#039;t update the admin options.</p><p>To avoid this, all values of $pun_config[&#039;o_base_url&#039;] have to be changed as well. I noticed that they are stored in the cache/cache_config.php file which, in turn, is generated by the include/cache.php script.</p><p>I came up with this little work around that works fine so far:</p><p>In <em>include/cache.php</em>, the function <em>generate_config_cache()</em> generates the code that defines the config array $pun_config that is apparently used across all scripts.</p><div class="codebox"><pre><code>// When accessed from the extranet on the external IP 123.123.123.123
$insertBaseUrl=&#039;
if (preg_match(\&#039;#123\.123\.123\.123#\&#039;, $_SERVER[\&#039;HTTP_REFERER\&#039;])) {
    $pun_config[\&#039;o_base_url\&#039;] = &quot;http://123.123.123.123/forum&quot; ;
}
&#039;;

fwrite($fh, &#039;&lt;?php&#039;.&quot;\n\n&quot;.&#039;define(\&#039;PUN_CONFIG_LOADED\&#039;, 1);&#039;.&quot;\n\n&quot;.&#039;$pun_config = &#039;.var_export($output, true).&#039;;&#039;.&quot;\n\n$insertBaseUrl\n\n&quot;.&#039;?&gt;&#039;);</code></pre></div><p>I&#039;ll see if it works in all cases.&nbsp; Thanks for your input anyway.</p>]]></description>
			<author><![CDATA[null@example.com (ripat)]]></author>
			<pubDate>Tue, 22 Jan 2008 20:51:00 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/107469/#p107469</guid>
		</item>
		<item>
			<title><![CDATA[Re: base URL, intranet only and limited external access]]></title>
			<link>https://punbb.informer.com/forums/post/107464/#p107464</link>
			<description><![CDATA[<p>Let&#039;s see...</p><p>Open functions.php<br />Replace<br /></p><div class="codebox"><pre><code>function confirm_referrer($script)
{
    global $pun_config, $lang_common;

    if (!preg_match(&#039;#^&#039;.preg_quote(str_replace(&#039;www.&#039;, &#039;&#039;, $pun_config[&#039;o_base_url&#039;]).&#039;/&#039;.$script, &#039;#&#039;).&#039;#i&#039;, str_replace(&#039;www.&#039;, &#039;&#039;, (isset($_SERVER[&#039;HTTP_REFERER&#039;]) ? $_SERVER[&#039;HTTP_REFERER&#039;] : &#039;&#039;))))
        message($lang_common[&#039;Bad referrer&#039;]);
}</code></pre></div><p>With<br /></p><div class="codebox"><pre><code>function confirm_referrer($script)
{
    global $pun_config, $lang_common;
    
    $baseurls = array(
        &#039;url1&#039;,
        &#039;url2&#039;);
    $bad = true;
    
    foreach($baseurls as $baseurl)
        if (preg_match(&#039;#^&#039;.preg_quote(str_replace(&#039;www.&#039;, &#039;&#039;, $baseurl).&#039;/&#039;.$script, &#039;#&#039;).&#039;#i&#039;, str_replace(&#039;www.&#039;, &#039;&#039;, (isset($_SERVER[&#039;HTTP_REFERER&#039;]) ? $_SERVER[&#039;HTTP_REFERER&#039;] : &#039;&#039;))))
            $bad = false;
    
    if($bad)
        message($lang_common[&#039;Bad referrer&#039;]);
}</code></pre></div><p>Note that it&#039;s untested and you can&#039;t use the admin config setting anymore.</p>]]></description>
			<author><![CDATA[null@example.com (elbekko)]]></author>
			<pubDate>Tue, 22 Jan 2008 17:58:44 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/107464/#p107464</guid>
		</item>
		<item>
			<title><![CDATA[Re: base URL, intranet only and limited external access]]></title>
			<link>https://punbb.informer.com/forums/post/107459/#p107459</link>
			<description><![CDATA[<div class="quotebox"><cite>elbekko wrote:</cite><blockquote><p>You could also look into setting up multiple base URLs.</p></blockquote></div><p>And how and where can I define this?</p>]]></description>
			<author><![CDATA[null@example.com (ripat)]]></author>
			<pubDate>Tue, 22 Jan 2008 17:07:52 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/107459/#p107459</guid>
		</item>
		<item>
			<title><![CDATA[Re: base URL, intranet only and limited external access]]></title>
			<link>https://punbb.informer.com/forums/post/107458/#p107458</link>
			<description><![CDATA[<p>You could also look into setting up multiple base URLs.</p>]]></description>
			<author><![CDATA[null@example.com (elbekko)]]></author>
			<pubDate>Tue, 22 Jan 2008 16:56:39 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/107458/#p107458</guid>
		</item>
		<item>
			<title><![CDATA[Re: base URL, intranet only and limited external access]]></title>
			<link>https://punbb.informer.com/forums/post/107456/#p107456</link>
			<description><![CDATA[<p>You can setup a reverse proxy on your LAN then connect to your forum via this reverse proxy or maybe remote access to a local machine and then access to the forum via this machine</p>]]></description>
			<author><![CDATA[null@example.com (yemgi)]]></author>
			<pubDate>Tue, 22 Jan 2008 16:34:28 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/107456/#p107456</guid>
		</item>
		<item>
			<title><![CDATA[base URL, intranet only and limited external access]]></title>
			<link>https://punbb.informer.com/forums/post/107454/#p107454</link>
			<description><![CDATA[<p>I just installed PunBB on a intranet. From inside that intranet the forum is accessed with the internal host name. Base URL is that internal host name.</p><p>No problem so far, at least locally. But...</p><p>As it is an intranet only forum, access is restricted in a .htaccess to the locale IP&#039;s (192.168.10.0/8) and to my own external IP.</p><p>I can access the forum with it&#039;s external IP (no host name, just a fixed IP) but, as soon that I want to do some changes I get the infamous &quot;Bad HTTP_REFERER.&quot; message. And I can&#039;t use the fixed (external) IP as the access is restricted to the local IP&#039;s.</p><p>Any work around without removing the base URL protection?</p>]]></description>
			<author><![CDATA[null@example.com (ripat)]]></author>
			<pubDate>Tue, 22 Jan 2008 16:12:49 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/107454/#p107454</guid>
		</item>
	</channel>
</rss>
