<?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"
	>

<channel>
	<title>Headers Already Sent</title>
	<atom:link href="http://mikelaming.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://mikelaming.com/blog</link>
	<description>A Weblog by Mike Laming</description>
	<pubDate>Sun, 05 Oct 2008 22:33:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Man&#8217;s Search For Meaning</title>
		<link>http://mikelaming.com/blog/2008/10/05/mans-search-for-meaning/</link>
		<comments>http://mikelaming.com/blog/2008/10/05/mans-search-for-meaning/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 22:33:04 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Philosophy]]></category>

		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=176</guid>
		<description><![CDATA[I&#8217;m really getting through books fast at the moment and I&#8217;ve just finished another brilliant one - Man&#8217;s Search For Meaning by Viktor E. Frankl.
This book is split into two distinct sections. The first is a very touching, inspiring account of the authors time in concentration camps during WW2. I found his analysis of the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m really getting through books fast at the moment and I&#8217;ve just finished another brilliant one - <a href="http://www.amazon.co.uk/Mans-Search-Meaning-Classic-Holocaust/dp/1844132390/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1223244641&amp;sr=8-1">Man&#8217;s Search For Meaning by Viktor E. Frankl</a>.</p>
<p>This book is split into two distinct sections. The first is a very touching, inspiring account of the authors time in concentration camps during WW2. I found his analysis of the different psychological stages they went through really fascinating and the modest prose in which he spoke about his experience was humbling.</p>
<p>The second section is a summary of his philosophy of Logotherapy. Although this raised a number of insightful points, towards the end I realised that as I only have a passing interest in real psychology this section was largely wasted on me. Still, it&#8217;s not too hardcore and there&#8217;s plenty to take away from it.</p>
<p>So if you&#8217;re looking for meaning in your life, give it a read!</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/10/05/mans-search-for-meaning/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Storing monetary values in MySQL</title>
		<link>http://mikelaming.com/blog/2008/10/05/storing-monetary-values-in-mysql/</link>
		<comments>http://mikelaming.com/blog/2008/10/05/storing-monetary-values-in-mysql/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 22:03:12 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=174</guid>
		<description><![CDATA[Just a quick one. I was doing a bit of work earlier today and I needed to store a price like &#8220;0000.00&#8243; in a MySQL database. As you can see there are quite a lot of options for numerical data types, and the first thing that came to my mind was FLOAT.
However, I ended up [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick one. I was doing a bit of work earlier today and I needed to store a price like &#8220;0000.00&#8243; in a MySQL database. As <a href="http://dev.mysql.com/doc/refman/4.1/en/numeric-types.html">you can see</a> there are quite a lot of options for numerical data types, and the first thing that came to my mind was FLOAT.</p>
<p>However, I ended up settling on DECIMAL which allows you to set the precision (significant digits) and the scale (digits after decimal point) and this seems to work (as far as I&#8217;m aware you can also do this with FLOAT too). So for example I defined my field like so:</p>
<blockquote><p>DECIMAL(4,2)</p></blockquote>
<p>I can&#8217;t remember off the top of my head what the difference is between FLOAT and DECIMAL. I think it&#8217;s to do with the way they are stored internally, with DECIMAL working in the way you&#8217;d most often expect. Anybody know any different?</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/10/05/storing-monetary-values-in-mysql/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finally! Something that cuts through the crap</title>
		<link>http://mikelaming.com/blog/2008/10/02/finally-something-that-cuts-through-the-crap/</link>
		<comments>http://mikelaming.com/blog/2008/10/02/finally-something-that-cuts-through-the-crap/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 21:28:39 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Philosophy]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=172</guid>
		<description><![CDATA[I was having a bit of a &#8220;non duality contemplation session&#8221; last night and came across a site that really seems to cut the BS and give some answers. You can browse it for yourselves here. All of the other advaita teachers try to make it simple, often saying things like &#8220;you are that&#8221;, &#8220;they [...]]]></description>
			<content:encoded><![CDATA[<p>I was having a bit of a &#8220;non duality contemplation session&#8221; last night and came across a site that really seems to cut the BS and give some answers. You can browse it for yourselves <a href="http://www.albigen.com/uarelove/most_rapid/contents.aspx">here</a>. All of the other advaita teachers try to make it simple, often saying things like &#8220;you are that&#8221;, &#8220;they seeker is the sought&#8221;, &#8220;stay with the I am&#8221; and so on, but these seemed vague to me and left me with questions. That site lays it down as clearly as &#8220;I&#8221; could hope for.</p>
<p>Also, found a really amazing video that can be watched <a href="http://www.microclesia.com/?p=320">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/10/02/finally-something-that-cuts-through-the-crap/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP session problems</title>
		<link>http://mikelaming.com/blog/2008/09/29/php-session-problems/</link>
		<comments>http://mikelaming.com/blog/2008/09/29/php-session-problems/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 20:42:43 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=170</guid>
		<description><![CDATA[Sessions are funny things. Most of the time they work first time and you never have to think about them again. Other times you run into a few issues.
Tonight I thought everything was fine, then I did a simple page redirect. On the other side I tried to read from $_SESSION and everything had disappeared. [...]]]></description>
			<content:encoded><![CDATA[<p>Sessions are funny things. Most of the time they work first time and you never have to think about them again. Other times you run into a few issues.</p>
<p>Tonight I thought everything was fine, then I did a simple page redirect. On the other side I tried to read from $_SESSION and everything had disappeared. I spent too long pouring through the code before I realised what was wrong.</p>
<p>Apparently PHP / Apache regards &#8220;www&#8221; as a subdomain. I was redirecting from http://example.com to http://www.example.com so everything got dropped. A simple mistake to make and easily overlooked. When I figured out the problem I found <a href="http://uk3.php.net/manual/en/book.session.php#85224">this post</a> on PHP.net.</p>
<p>Strangely I&#8217;ve never noticed this behavior before. I wonder if it has always been there or it varies between Apache 1.3 and 2.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/09/29/php-session-problems/feed/</wfw:commentRss>
		</item>
		<item>
		<title>If you only read one book in your life&#8230;</title>
		<link>http://mikelaming.com/blog/2008/09/25/if-you-only-read-one-book-in-your-life/</link>
		<comments>http://mikelaming.com/blog/2008/09/25/if-you-only-read-one-book-in-your-life/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 20:33:41 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Philosophy]]></category>

		<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=168</guid>
		<description><![CDATA[&#8230;make sure that it&#8217;s &#8220;How to Win Friends and Influence People&#8221; by Dale Carnegie.
I&#8217;ve gobbled this book up in just over a day (against the authors advice) and I have to say it&#8217;s one of the best books I&#8217;ve ever read.
Go. Read. Now.
]]></description>
			<content:encoded><![CDATA[<p>&#8230;make sure that it&#8217;s &#8220;<a href="http://www.amazon.co.uk/How-Win-Friends-Influence-People/dp/0091906814/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1222374553&amp;sr=8-1">How to Win Friends and Influence People</a>&#8221; by Dale Carnegie.</p>
<p>I&#8217;ve gobbled this book up in just over a day (against the authors advice) and I have to say it&#8217;s one of the best books I&#8217;ve ever read.</p>
<p>Go. Read. Now.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/09/25/if-you-only-read-one-book-in-your-life/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A bit on PHP security</title>
		<link>http://mikelaming.com/blog/2008/09/21/a-bit-on-php-security/</link>
		<comments>http://mikelaming.com/blog/2008/09/21/a-bit-on-php-security/#comments</comments>
		<pubDate>Sun, 21 Sep 2008 14:17:45 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=165</guid>
		<description><![CDATA[PHP really is a smashing language, allowing you to knock out rich applications quickly and easily. As anyone with half a brain will realise though, giving power to people that don&#8217;t have a clue is a recipe for a disaster.
This is by no means a comprehensive list, but here are some common security issues that [...]]]></description>
			<content:encoded><![CDATA[<p>PHP really is a smashing language, allowing you to knock out rich applications quickly and easily. As anyone with half a brain will realise though, giving power to people that don&#8217;t have a clue is a recipe for a disaster.</p>
<p>This is by no means a comprehensive list, but here are some common security issues that I have encountered with some simple fixes.</p>
<p><strong>1. Use mysql_real_escape_string()</strong></p>
<p>SQL injection can be a big problem, but it is easily defeated. Validating every input into your web application is a must, whether it comes from $_POST or $_GET. If it passes this validation then you should wrap mysql_real_escape_string() around the variable to escape dangerous characters. For example:</p>
<blockquote><p>$query = &#8220;SELECT id FROM logins WHERE username=&#8217;&#8221;.mysql_real_escape_string($_POST['username']).&#8221;&#8216; AND password=&#8217;&#8221;.mysql_real_escape_string($_POST['password']).&#8221;&#8216;&#8221;;</p></blockquote>
<p><strong>2. XSS protection</strong></p>
<p>Cross site scripting is a real danger, but is something that can be protected against without too much work. Simply remove HTML / Javascript tags from any input by using str_replace or an equivalent. I find that I only need to worry about this when dealing with textareas, because text fields are usually a lot more locked down to the type of data that needs to go into them.</p>
<p><strong>3.URL Manipulation</strong></p>
<p>Web applications typically pass information through URLs. Consider the following link:</p>
<blockquote><p>view_personal_info.php?my_user_id=123</p></blockquote>
<p>In this example I think we can probably take &#8220;my_user_id&#8221; to be my id on the system. So what happens when I go to the URL with id 124 or 125? Will I get information on other users? Probably, and that&#8217;s why on every page you need to check that the current logged in user has the correct access to view the information.</p>
<p>This isn&#8217;t hard to do, so I&#8217;m not going to explain the solution here. However, if you&#8217;re passing a lot of information through a URL and want to make sure it&#8217;s not tampered with, then there&#8217;s a straightforward way to achieve this. Creating a hash of the data with a password only the application knows, passing it in the url  and revalidating it on the target page works a treat.</p>
<p><strong>4. Use forms, not links</strong></p>
<p>I&#8217;m guilty of having done this once or twice, mainly due to ignorance, but when you&#8217;re doing any database modification it should always happen through a form, not a link. Otherwise people can craft links to pages like delete and trick you into clicking on them. If the pages aren&#8217;t properly password protected, then it&#8217;s also possible that search engines can crawl your site and wreck your database.</p>
<p><strong>5. Other</strong></p>
<p>There are plenty of other little tweaks you can make to your PHP configuration to improve security, depending on what you&#8217;re doing and how locked down you want your server to be. Two little things I do when putting code on a live site are turning error messages off, and moving pages that don&#8217;t need to be read directly outside of public_html.</p>
<p>I think the hardest thing about PHP and web application security in general is the range of scope for attack. Every input has to be validated, and in a big application this can be easily overlooked. Unfortunately, it only takes one error to bring your entire application down.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/09/21/a-bit-on-php-security/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thorpe Park</title>
		<link>http://mikelaming.com/blog/2008/09/19/thorpe-park/</link>
		<comments>http://mikelaming.com/blog/2008/09/19/thorpe-park/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 12:56:39 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=161</guid>
		<description><![CDATA[Laura and I went to Thorpe Park yesterday to commiserate the end of the summer. The beautiful weather combined with a practically empty park made for a great day.
The highlight probably had to be Stealth, what a ride! I thought it combined Alton Towers&#8217; Rita with Oblivion. 0 - 80mph in under 2 seconds. Weeeeeeee!
]]></description>
			<content:encoded><![CDATA[<p>Laura and I went to Thorpe Park yesterday to commiserate the end of the summer. The beautiful weather combined with a practically empty park made for a great day.</p>
<p>The highlight probably had to be Stealth, what a ride! I thought it combined Alton Towers&#8217; Rita with Oblivion. 0 - 80mph in under 2 seconds. <strong>Weeeeeeee!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/09/19/thorpe-park/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Benefits of a managed VPS</title>
		<link>http://mikelaming.com/blog/2008/09/17/benefits-of-a-managed-vps/</link>
		<comments>http://mikelaming.com/blog/2008/09/17/benefits-of-a-managed-vps/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 14:29:22 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=156</guid>
		<description><![CDATA[Just got SVN / Trac setup on my VPS primarily to support development for portfolioexecutive.com.
I&#8217;ve succeeded in doing this myself before, but I remember the process to be a bit of a nightmare. Yesterday I dropped a line to the support guys at futurehosting.biz and they set it all up for me within 24 hours.
It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Just got SVN / Trac setup on my VPS primarily to support development for <a href="http://portfolioexecutive.com">portfolioexecutive.com</a>.</p>
<p>I&#8217;ve succeeded in doing this myself before, but I remember the process to be a bit of a nightmare. Yesterday I dropped a line to the support guys at futurehosting.biz and they set it all up for me within 24 hours.</p>
<p>It&#8217;s always worth paying a little extra; managed hosting is only more expensive if you don&#8217;t value your time. Giving the task to an expert has saved me a night of hell and I&#8217;m virtually guarateed it&#8217;ll do what it says on the tin!</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/09/17/benefits-of-a-managed-vps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Everyone should go and try Kublax!</title>
		<link>http://mikelaming.com/blog/2008/09/15/everyone-should-go-and-try-kublax/</link>
		<comments>http://mikelaming.com/blog/2008/09/15/everyone-should-go-and-try-kublax/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 09:22:35 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Reviews]]></category>

		<category><![CDATA[New Tech Startup]]></category>

		<category><![CDATA[Pretty Damn Cool]]></category>

		<category><![CDATA[Review]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=151</guid>
		<description><![CDATA[I was clicking around the interweb last night when I came across a site called Kublax.
Kublax grabs all your online bank accounts and gives you a &#8220;money overview&#8221;, with graphs and charts. It tells you how much of your money is being spent on bills and other things, and lets you setup alerts so you [...]]]></description>
			<content:encoded><![CDATA[<p>I was clicking around the interweb last night when I came across a site called <a href="http://www.kublax.com/">Kublax</a>.</p>
<p>Kublax grabs all your online bank accounts and gives you a &#8220;money overview&#8221;, with graphs and charts. It tells you how much of your money is being spent on bills and other things, and lets you setup alerts so you know the status of your bank account. Great customer service too, I emailed them at 7pm on a Sunday night and they got back to be within a few minutes.</p>
<p>I remember discussing a similar idea to this with Shazz about a year ago which never went anywhere, so I&#8217;m glad to see someone acting on it. Looks like they have got some pretty cool pipelined features too, so I look forward to trying it again when the product&#8217;s a bit more mature.</p>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/09/15/everyone-should-go-and-try-kublax/feed/</wfw:commentRss>
		</item>
		<item>
		<title>getElementsByName IE fix</title>
		<link>http://mikelaming.com/blog/2008/09/14/getelementsbyname-ie-fix/</link>
		<comments>http://mikelaming.com/blog/2008/09/14/getelementsbyname-ie-fix/#comments</comments>
		<pubDate>Sun, 14 Sep 2008 13:02:35 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mikelaming.com/blog/?p=149</guid>
		<description><![CDATA[I was recently writing a bit of javascript to collapse / expand sections on a page. These sections are output by a bit of PHP and I don&#8217;t know how many there are likely to be, so I gave them the same name and looped through them with getElementsByName().
Now this works fine with Firefox, but [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently writing a bit of javascript to collapse / expand sections on a page. These sections are output by a bit of PHP and I don&#8217;t know how many there are likely to be, so I gave them the same name and looped through them with getElementsByName().</p>
<p>Now this works fine with Firefox, but I ran into a few problems with IE. It turns out that IE doesn&#8217;t support it, but luckily someone has posted an alternative solution <a href="http://www.dreamincode.net/code/snippet293.htm">here</a> which I thought was rather clever. Here it is again incase the site isn&#8217;t available later on.</p>
<blockquote><p>function getElementsByName_iefix(tag, name) {</p>
<p>var elem = document.getElementsByTagName(tag);<br />
var arr = new Array();<br />
for(i = 0,iarr = 0; i &lt; elem.length; i++) {<br />
att = elem[i].getAttribute(&#8221;name&#8221;);<br />
if(att == name) {<br />
arr[iarr] = elem[i];<br />
iarr++;<br />
}<br />
}<br />
return arr;<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mikelaming.com/blog/2008/09/14/getelementsbyname-ie-fix/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
