<?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>SKYCUBE.net &#187; php</title>
	<atom:link href="http://www.skycube.net/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.skycube.net</link>
	<description>Projects, References and Personals by Per Lasse Baasch</description>
	<lastBuildDate>Wed, 04 Nov 2009 01:21:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Restricetd access to a web-application with htaccess or php</title>
		<link>http://www.skycube.net/2009/07/03/restricetd-access-to-a-web-application-with-htaccess-or-php/</link>
		<comments>http://www.skycube.net/2009/07/03/restricetd-access-to-a-web-application-with-htaccess-or-php/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 19:08:17 +0000</pubDate>
		<dc:creator>Per Lasse Baasch</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.skycube.net/?p=96</guid>
		<description><![CDATA[If you building a simple web-application and you are not really sure, ow secure are the authentication and or the rest of the application you should think about to limit the access to the application.
Furthermore, may your application should be available only for testing purpose of several customers the following could help you:
First way&#8230; using [...]]]></description>
			<content:encoded><![CDATA[<p>If you building a simple web-application and you are not really sure, ow secure are the authentication and or the rest of the application you should think about to limit the access to the application.<br />
Furthermore, may your application should be available only for testing purpose of several customers the following could help you:</p>
<p><strong>First way</strong>&#8230; using a <em>.htaccess</em> which controls the access using a apache web server.<br />
This is a very fast sollution <strong>BUT you CAN&#8217;T use</strong> <strong>hostnames</strong> and or full qualified <strong>dns names</strong> like skycube.net or yourname.dyndns.org</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>Limit GET HEAD POST<span style="color: #000000; font-weight: bold;">&gt;</span>
order deny,allow
allow from 62.75.185.219
allow from 127.0.1.1
allow from 127.0.0.1
deny from all
<span style="color: #000000; font-weight: bold;">&lt;/</span>Limit<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<hr style="margin: 10px;" />
<p><strong>The second way</strong>&#8230; which I prefer, using a php code snippet. This allows you to <strong>use hostnames and full qualified domain names</strong>. Definitely you can write it in less than the lines I used below for the code, but in of understanding what the code does, it&#8217;s better <img src='http://www.skycube.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * ACL array
 */</span>
<span style="color: #000088;">$valid_hosts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$valid_hosts</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$valid_hosts</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'127.0.0.1'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$valid_hosts</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'127.0.1.1'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$valid_hosts</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'yourname.dyndns.org'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$valid_hosts</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'skycube.net'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>sizeof<span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_hosts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$valid_ip</span> <span style="color: #339933;">=</span> <span style="color: #990000;">gethostbyname</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_hosts</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_ip</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$valid_state</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'valid'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$valid_state</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'invalid'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$valid_state</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'valid'</span><span style="color: #009900;">&#41;</span>
  <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://www.skycube.net&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.skycube.net/2009/07/03/restricetd-access-to-a-web-application-with-htaccess-or-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Usefully phpMyAdmin config vars</title>
		<link>http://www.skycube.net/2009/06/16/usefully-phpmyadmin-config-vars/</link>
		<comments>http://www.skycube.net/2009/06/16/usefully-phpmyadmin-config-vars/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 19:24:32 +0000</pubDate>
		<dc:creator>Per Lasse Baasch</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.skycube.net/?p=75</guid>
		<description><![CDATA[While working with large databases, phpMyAdmin is in serveral cases not the perfect application to handle changes and or administrate the databases but may the only one you are allowed to use.
In this order there are two default configuration the following to configuration vars will help you to work better and faster.
Show all rows without [...]]]></description>
			<content:encoded><![CDATA[<p>While working with large databases, <strong>phpMyAdmin</strong> is in serveral cases not the perfect application to handle changes and or administrate the databases but may the only one you are allowed to use.</p>
<p>In this order there are two default configuration the following to configuration vars will help you to work better and faster.</p>
<p>Show all rows without a limit:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ShowAll'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span></pre></div></div>

<p>Show full update statements:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'MaxCharactersInDisplayedSQL'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">2147483647</span><span style="color: #339933;">;</span></pre></div></div>

<p>In order to the default value, updates with <strong>more than 1000 chars</strong> will be replaced with <strong>[…]</strong>.</p>
<p>Just place these in the <em><strong>config.inc.php</strong></em> e.g. <em><strong>/var/www/htdocs/phpmyadmin/config.inc.php</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.skycube.net/2009/06/16/usefully-phpmyadmin-config-vars/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
