<?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>Pixel Acres &#187; Programming</title>
	<atom:link href="http://f6design.com/journal/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://f6design.com/journal</link>
	<description>Adventures in web and graphic design</description>
	<lastBuildDate>Thu, 11 Mar 2010 02:37:53 +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>Ajax form validation using FormBuilder</title>
		<link>http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/</link>
		<comments>http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/#comments</comments>
		<pubDate>Sat, 15 Dec 2007 00:06:00 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[News & Reviews]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toolbox]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/</guid>
		<description><![CDATA[Over at roScripts there is a nice tutorial explaining how to modify my FormBuilder PHP class so that validation is performed unobtrusively using AJAX. Check it out.
]]></description>
			<content:encoded><![CDATA[<p>Over at roScripts there is a <a href="http://www.roscripts.com/Unobtrusive_Ajax_PHP_form_validation-188.html">nice tutorial</a> explaining how to modify my <a href="http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/">FormBuilder PHP</a> class so that validation is performed unobtrusively using AJAX. Check it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/12/14/ajax-form-validation-using-formbuilder/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The trouble with content management systems</title>
		<link>http://f6design.com/journal/2007/11/30/the-trouble-with-content-management-systems/</link>
		<comments>http://f6design.com/journal/2007/11/30/the-trouble-with-content-management-systems/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 21:14:13 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/11/30/the-trouble-with-content-management-systems/</guid>
		<description><![CDATA[When I started out as a web designer, content management systems belonged strictly to the realm of big budget websites. For everyone else, it was perfectly normal for a web designer to manually update a site whenever a change needed to be made. Clients didn&#8217;t expect a CMS to be included with their website, and [...]]]></description>
			<content:encoded><![CDATA[<p>When I started out as a web designer, content management systems belonged strictly to the realm of big budget websites. For everyone else, it was perfectly normal for a web designer to manually update a site whenever a change needed to be made. Clients didn&#8217;t expect a CMS to be included with their website, and web designers didn&#8217;t offer the option. Times have certainly changed, and in an age of blogs, Facebook, and MySpace, clients expect to be able to take control of their website&#8217;s content.</p>
<p>For most web designers, especially those who work solo, a custom built content management system is still a tall order. Fortunately there are numerous commercial and open source content management systems available, which offer a practical and affordable means of wrangling content. However, a &#8220;one size fits all&#8221; content management system that doesn&#8217;t address a site&#8217;s specific content requirements can introduce as many problems as it solves.</p>
<h3>One page, one blob</h3>
<p>The easier a content management system (CMS) is to configure and use, the more restrictive it is likely to be. HTML and CSS offer a rich toolset for describing and presenting all kinds of content, yet most CMSs cannot be configured to address the myriad types of content a content editor needs to display. Instead, the content editor is given the ability to modify just one &#8220;blob&#8221; of content per webpage. This format suits the majority of webpages, but assumes that the content editor is happy to have just one block of plain text per page, or that they are comfortable styling text with regular HTML tags, or a &#8217;simplified&#8217; variation such as <a href="http://daringfireball.net/projects/markdown/">markdown</a>. For the novice, HTML is hardly child&#8217;s play, and trusting a client to write compliant markup is optimistic to say the least. That&#8217;s where WYSIWYG (What You See Is What You Get, pronounced &#8220;wizzywig&#8221;) editors come to the rescue, and that&#8217;s when problems start to creep in.</p>
<h3>The WYSIWYG problem</h3>
<p>The WYSIWYG editor is at the heart of most modern content management systems, if not by design, then because web designers install one themselves. They are used as a &#8220;cure all&#8221; by CMS developers and web designers alike, because they provide content editors with a powerful interface for styling content, using a toolset that replicates the desktop word processors with which they are already familiar. The two most popular WYSIWG editors are <a href="http://tinymce.moxiecode.com/">TinyMCE</a> and <a href="http://www.fckeditor.net/">FCKEditor</a>. Both use Javascript to enhance a regular HTML textarea, and do so via a menu of buttons similar to that found in Microsoft Word. This probably sounds ideal &#8211; a website&#8217;s content editor can take total ownership of their content, styling it in any way they please. But content editors are precisely that: editors. They are not designers, and shouldn&#8217;t have to &#8211; or be <em>allowed</em> to &#8211; make decisions that affect the design of their content. Sadly, this is exactly the power that WYSIWYG editors put at their fingertips.</p>
<p><img class="contentImg matte" src='http://f6design.com/journal/wp-content/uploads/2007/11/tinymce.jpg' alt='Tinymce' /></p>
<p class="caption">Tinymce in all its glory. Watch your client destroy your layout in mere seconds!</p>
<p>Let loose with a WYSIWYG editor a content editor can mix and match font size, face and color, and even add tables, images, background colors, and emoticons to a webpage. If you think they will have the self control to exercise restraint, think again. Even the ability to alter the appearance of text can have disastrous results. I have seen a content editor use a WYSIWG editor to set body copy in 16 point, 12 point, and 10 point at various places on the same page, and in three different typefaces. Another client inexplicably changed the color of list items to exactly the same blue used throughout the site to indicate hyperlinks. The impact such misguided decisions have on usability and design should be obvious.</p>
<p>Of course the blame doesn&#8217;t lie with the content editor. They don&#8217;t have training as a graphic designer, nor can we expect them  to grasp the subtleties of interactive design. The problem is that WYSIWYG editors mix the <em>description</em> of content (headings, lists, blockquotes) with its <em>design</em> (typefaces, colors, and point sizes). Web designers have long understood the importance of separating content from presentation, but WYSIWYG editors snatch that separation away from us.</p>
<h3>Dial it back</h3>
<p>Fortunately, most WYSIWYG editors allow you to limit their functionality to suit your needs. This can either be done using a CMS&#8217;s administration interface, or by editing a configuration file. When faced with a WYSIWYG editor I dial its functionality right back, leaving only the core set of tools needed to effectively describe content. Does a content editor need to specify background colors for text? Of course not. The size of text? Nope. Paragraph alignment? Uh-uh. Tables? Lets not even go there. I don&#8217;t even let a content editor underline text. Why? Because underlined text looks like a link.</p>
<p>Headings (h1, h2 etc), bold, italic, ordered lists, unordered lists, blockquotes, and hyperlinks: these should provide sufficient scope to describe most types of content. Let your regular CSS stylesheets style the output, and you&#8217;ll ensure the rendered content fits seamlessly with your existing website layout.</p>
<h3>The copy and paste problem</h3>
<p>WYSIWYG editors present another problem I haven&#8217;t touched on yet. Usually a website&#8217;s copy isn&#8217;t typed directly into a content management system, it is composed in a word processor, then pasted into the CMS. When this happens the formatting of the source text is brought across too, warts and all. Despite your best efforts to limit your client&#8217;s ability to style content, with one keystroke they can inadvertently bypass your safeguards. There are two solutions to this problem. The first involves education. Both FCKEditor and TinyMCE include a &#8216;paste as plain text&#8217; button, that gives users the option of stripping all formatting from text as it is pasted into the WYSIWYG editor. The only problem is that your client needs to remember to use the button. The second option is more pro-active. Both FCKEditor and TinyMCE have a configuration setting that forces content to be pasted as plain text.</p>
<h3>What about web standards?</h3>
<p>A criticism often leveled at WYSIWYG editors is that they produce spaghetti code. In part, this is true. The only way a WYSIWYG editor can define the color of text, for instance, is by applying an inline style to your markup. But if you limit the WYSIWYG to a few core capabilities, as I suggested above, there is far less that can go wrong. The developers of WSIWYG editors are mindful of the need for standards compliance, and I have found that in most cases it isn&#8217;t hard to get both TinyMCE and FCKEditor to generate tidy markup.</p>
<h3>Other options</h3>
<p>Building a CMS from scratch is a huge task. I ought to know &#8211; most of my websites are powered by a CMS I built myself. Unless you are a competent programmer and have a heap of time up your sleeve (or just enjoy a challenge!), building your own CMS isn&#8217;t an option I would recommend lightly, but the advantages of the DIY route certainly pay off in the long run.</p>
<p>Building your own CMS gives you absolute control over how the software functions, allowing you to customize it to your own needs with fine grained control. When something breaks, you know how to fix it. If you want to add a new feature to the CMS, you just go ahead and add it, rather than submitting a feature request to the software vendor and crossing your fingers.</p>
<p>Another option to consider is <a href="http://xstandard.com/">XStandard</a>, a WYSIWYG editor that touts its standards compliance and accessibility features. The big drawback I can see with XStandard is that it requires the content editor to install the XStandard application on their local machine. By contrast, a javascript based WYSIWYG editor makes your website editable from any computer sporting a modern web browser.</p>
<p>Whichever approach you take to content management, so long as you give careful thought to both your client&#8217;s needs and the pitfalls of giving them free rein, it is possible to strike a balance that keeps everyone happy. Giving clients the ability to edit their website&#8217;s content, and creating beautiful, standards compliant websites needn&#8217;t be mutually exclusive goals.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/11/30/the-trouble-with-content-management-systems/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>FormBuilder update: send variables by email</title>
		<link>http://f6design.com/journal/2007/07/14/formbuilder-update-send-variables-by-email/</link>
		<comments>http://f6design.com/journal/2007/07/14/formbuilder-update-send-variables-by-email/#comments</comments>
		<pubDate>Sun, 15 Jul 2007 00:54:34 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2007/07/14/formbuilder-update-send-variables-by-email/</guid>
		<description><![CDATA[I have made another update to my FormBuilder class. Version 1.4 features a new function, emailResults, which can be used to automatically send the user-submitted form variables to any email address. A number of readers asked for this functionality, which eliminates the need to write your own form processing routine. Have fun!
]]></description>
			<content:encoded><![CDATA[<p>I have made another update to my <a href="http://f6design.com/journal/2007/04/27/formbuilder-html-forms-made-simple/">FormBuilder</a> class. Version 1.4 features a new function, <code>emailResults</code>, which can be used to automatically send the user-submitted form variables to any email address. A number of readers asked for this functionality, which eliminates the need to write your own form processing routine. Have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2007/07/14/formbuilder-update-send-variables-by-email/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securing PHP Contact Forms</title>
		<link>http://f6design.com/journal/2006/12/09/securing-php-contact-forms/</link>
		<comments>http://f6design.com/journal/2006/12/09/securing-php-contact-forms/#comments</comments>
		<pubDate>Sun, 10 Dec 2006 05:59:36 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2006/12/09/securing-php-contact-forms/</guid>
		<description><![CDATA[One of the great benefits of PHP is that it is quick and easy for non-programmers to learn the basics of the language and begin to add server-side logic to their websites. This simplicity is a double edged sword, as many novice programmers are unaware of PHP&#8217;s security vulnerabilities and inadvertently create web applications that [...]]]></description>
			<content:encoded><![CDATA[<p>One of the great benefits of PHP is that it is quick and easy for non-programmers to learn the basics of the language and begin to add server-side logic to their websites. This simplicity is a double edged sword, as many novice programmers are unaware of PHP&#8217;s security vulnerabilities and inadvertently create web applications that are an easy target for hackers and spammers. Most <a href="http://www.ilovejackdaniels.com/php/writing-secure-php/">PHP security holes</a> are well documented, but a newer and lesser known vulnerability is header injection, a cunning exploit whereby a spammer hijacks a website&#8217;s contact form and uses it to send bulk unsolicited email.</p>
<h3>How they do it</h3>
<p>An email is composed simply of raw text that is formatted using a standardized syntax. When we add a contact form to a website we allow our visitors to supply data such as their name, email address, subject and message, which we then format and send using PHP&#8217;s mail function. For instance:</p>
<pre><code>&lt;?php

  $recipient = 'recipient@mydomain.com';
  $subject = $_POST["subject"];
  $message = $_POST["message"];
  $headers = "From: ".$_POST["email"];
  mail($recipient,$subject,$message,$headers);

?&gt;</code></pre>
<p>will produce the following raw email data:</p>
<pre><code>To: recipient@mydomain.com
Subject: Hello
From: sender@theirdomain.com

Hi, I love your site.</code></pre>
<p>Seems harmless enough, right? We have hard coded the recipient&#8217;s email address in PHP, so it would be natural to assume that a visitor couldn&#8217;t use our contact form to send an email to anyone except the intended recipient.</p>
<p><strong>Wrong!</strong></p>
<p>Because we include the visitor&#8217;s email address in the email header, it is surprisingly simple for a malicious user to insert additional headers in the email field. They can do this in the following manner:</p>
<pre><code>sender@theirdomain.com%0ABcc:recipient@anotherdomain.com</code></pre>
<p>%0A is the hexidecimal representation of a linefeed, and forces a line break in the email&#8217;s header block. Now the raw email will look like this:</p>
<pre><code>To: recipient@mydomain.com
Subject: Hello
From: sender@theirdomain.com
Bcc: recipient@anotherdomain.com

Hi, I love your site.</code></pre>
<p>In this basic example the spammer has simply inserted a single additional recipient. In practice they will use more advanced injection techniques to hide your original message and display their own in its place, and will also insert the email addresses of thousands of hapless recipients. Now your form is being used to send spam.</p>
<p>As the hard coded recipient of the form, the website owner (your client) will become aware that something fishy is going on when they begin to receive large amounts of spam, apparently originating from their own site. Shortly your web host will also notice the high volume of spam emails being sent from your client&#8217;s domain, and shut the site down. They will send you an irate email requesting that your patch your insecure PHP scripts or find another hosting company. Needless to say, this chain of events is bad for your relationship with both your web host and your client!</p>
<h3>The solution</h3>
<p>Protecting against header injection attacks is a simple matter of validating user supplied data. Primarily, header injection relies on the attacker being able to include linebreaks in strings that will appear in an email&#8217;s header. By testing for the presence of these linebreaks in user-supplied data we can stop the spammer in their tracks. I have written a small function to simplify this process &#8211; it accepts as its parameter an array of the header fields we need to test:</p>
<pre><code>&lt;?php

function checkFields($values){
	$injection = false;
	for ($n=0;$n&lt;count($values);$n++){
		if (eregi("%0A",$values[$n]) || eregi("%0D",$values[$n]) || eregi("\\r",$values[$n]) || eregi("\\n",$values[$n])){
			$injection = true;
		}
	}
	return $injection;
}

$from = $_POST['from'];
$email = $_POST['email'];
$result = checkFields(Array($from,$email));
if ($result==true){
	die("Header injection detected!");
}

?&gt;</code></pre>
<h3>How to tell if your form is being exploited</h3>
<p>To test a form to see if it is vulnerable, a spammer will first try and inject a single bcc header containing a throwaway email address (usually an AOL address). They then check that AOL address to see if they received the test email. If so, they will begin using your form as a spam relay.</p>
<p>The only flaw in this otherwise perfect plan is that the email&#8217;s intended recipient (whose email address is hard coded into your PHP form handling script) will also be receiving these probe emails.</p>
<p>So if one of your clients complains they are getting a lot of &#8217;spam&#8217; sent to them via their contact form, sit up and pay attention. There is a chance the &#8217;spam&#8217; they mention is actual a spammer&#8217;s probe emails. Ask your client to send you a few examples of the emails they are receiving. A probe will contain text that looks something like this:</p>
<pre><code>said

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: an wan that makes me proud iv ailey f
bcc: onemoreaddress@hotpop.com

934522c25fb7a2507489e97c4043af14</code></pre>
<h3>I&#8217;m still getting annoying probe emails</h3>
<p>Even though your form validation may already be filtering header fields for line breaks, you may still receive a spammer&#8217;s probe emails. This is because the spammer &#8211; or more precisely their &#8217;spambot&#8217; &#8211; is attempting to blindly inject into <em>every</em> form field it finds, including the &#8216;message&#8217; field (the probe example I gave above was actually the result of a spammer&#8217;s attempt to inject into the message field of a client&#8217;s contact form). The message field doesn&#8217;t pose a security risk since it does not appear in the email&#8217;s header, but unless you validate it as well then the form&#8217;s intended recipient will continue receiving probe emails. Of course the message field can legitimately contain linebreaks, so you will need to validate it for other telltale strings such as &#8220;Bcc:&#8221; or &#8220;Content-Type:&#8221; both of which are common in injection attacks. Make sure your validation ignores case, since an email header is case insensitive.</p>
<h3>Conclusion</h3>
<p>Validate, validate, validate. And don&#8217;t trust your website visitors, not all of them are good guys!</p>
<h3>Further reading</h3>
<h4><a href="http://www.securephpwiki.com/index.php/Email_Injection">Email Injection</a></h4>
<p>For a really detailed description of email header injection in PHP, check out the Secure PHP wiki page on the topic.</p>
<h4><a href="http://www.anders.com/projects/sysadmin/formPostHijacking/">Form Post Hijacking</a></h4>
<p>When header injection attacks became widespread a couple of my sites were compromised. I found this article useful in helping me understand the problem.</p>
<p><strong>UPDATE 12 Dec 2006:</strong> I realized that I had forgotten to double escape the \ characters in my validation function when I posted this article, so they weren&#8217;t showing up. Whoops! I have updated the function accordingly.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2006/12/09/securing-php-contact-forms/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Image source swapping, CSS, and Safari</title>
		<link>http://f6design.com/journal/2006/09/29/image-source-swapping-css-and-safari/</link>
		<comments>http://f6design.com/journal/2006/09/29/image-source-swapping-css-and-safari/#comments</comments>
		<pubDate>Fri, 29 Sep 2006 23:56:44 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2006/09/29/image-source-swapping-css-and-safari/</guid>
		<description><![CDATA[Last week I was putting the finishing touches on a small website I created for a friend. Specifically, I was jazzing up the image gallery with an ‘Image loading…’ animation, so that visitors knew to hang around while a new image loaded. In the process I made an interesting discovery about the way Safari (Safari [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I was putting the finishing touches on a small website I created for a friend. Specifically, I was jazzing up the image gallery with an ‘Image loading…’ animation, so that visitors knew to hang around while a new image loaded. In the process I made an interesting discovery about the way Safari (Safari 1.2 at any rate) handles javascript image source swapping.</p>
<p>The image gallery was controlled by a Javascript which swapped the <code>src</code> parameter of a placeholder <code>img</code> tag each time the user selected a new image.</p>
<p>In my HTML markup I had a basic image tag with an ID applied to it:</p>
<pre><code>&lt;img id="placeholderimage" alt="" /&gt;</code></pre>
<p>When the user selected a new image (by clicking ‘next’ or ‘prev’ in my image gallery navigation), a javascript was triggered to load a jpeg into the placeholder:</p>
<pre><code>document.getElementById('placeholderimage').src = "mynewpic.jpg";</code></pre>
<p>The problem with this method is that while the new image loads into the placeholder, the old image remains on the page. To the user it appears as if nothing is happening. The solution is to hide the image while it loads, and show the user some sort of load indicator while they wait. When the image has completed loading, reveal it again and hide the load indicator.</p>
<p>The specifics of hiding/revealing the load indicator are beyond the scope of this article, so I won’t bore you with them here. Instead I’ll demonstrate the method by which I hid and revealed the image, as that is what caused problems in Safari.</p>
<p>To hide the image, I used javascript to apply the CSS style <code>display:none</code> before loading the new jpeg. I also created an <code>onload</code> event handler for my image, to detect when it had finished loading. Inside my <code>onload</code> function I revealed the image again:</p>
<pre><code>document.getElementById('placeholderimage').onload=function(){
        document.getElementById('placeholderimage').style.display = "block";
};
document.getElementById('placeholderimage').style.display = "none";
document.getElementById('placeholderimage').src = "mynewpic.jpg";</code></pre>
<p>Easy peasy. The image is removed from the document flow when it starts to load, and returned when it finishes.</p>
<p>Everything seemed to be rocking nicely, until I fired up the site Safari 1.2. The image was hiding as expected, but my <code>onload</code> function was never evoked. After some head scratching I traced the problem to my use of <code>display:block</code> when hiding the image. I think Safari’s logic is that because the image is no longer part of the document flow, there is no point bothering to load it. Unlike other browsers, Safari never initiated the image load, and that’s why the <code>onload</code> never fired.</p>
<p>Armed with this new knowledge, we have a couple of &#8220;Safari friendly&#8221; options at our displosal:</p>
<ul>
<li>
<h5>Use visibility not display</h5>
<p>If we use <code>visibility = "hidden";</code> instead of <code>display = "none";</code> to hide the image, everything works fine. The problem with using <code>visibility</code> is that the image is not removed from the document flow, meaning a gap is left on the page where the image used to be. Depending on the layout of your image gallery that may not be an issue for you &#8211; it may in fact be desirable. If it is an issue, you can set the height of the image (or it’s containing element if there is one) to zero, then use the onload handler to reset it to it’s correct height. Fiddly, but it works.
</li>
<li>
<h5>Move the image outside the viewport</h5>
<p>If your image has the CSS property <code>position:absolute</code>, then you should be able to move it off screen by setting either it’s <code>top</code> or <code>left</code> property to a suitable low value, for example: <code>left: -1000em</code>; That ought to place the image off screen out of sight.</li>
</ul>
<p>There may be other alternatives, and you can choose the one that suits you best. The important thing to remember is don’t use <code>display:block</code> to hide images while you swap their image source, or risk the wrath of Safari users!</p>
<p>For anyone interested to see the final implementation of my image gallery, <a href="http://www.archivedestruct.com/documentation/pr/images.php">here it is</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2006/09/29/image-source-swapping-css-and-safari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Flash perspective on PHP releases</title>
		<link>http://f6design.com/journal/2006/07/28/a-flash-perspective-on-php-releases/</link>
		<comments>http://f6design.com/journal/2006/07/28/a-flash-perspective-on-php-releases/#comments</comments>
		<pubDate>Fri, 28 Jul 2006 12:53:50 +0000</pubDate>
		<dc:creator>Jonathan</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://f6design.com/journal/2006/07/28/a-flash-perspective-on-php-releases/</guid>
		<description><![CDATA[It strikes me as odd that the uptake of PHP5 has been so slow. The snail&#8217;s pace at which web hosts are migrating to PHP5 has been hampered not by lack of user interest, but because a few popular PHP applications (OSCommerce, for one) break under PHP5. In this respect, I suppose the web host&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>It strikes me as odd that the uptake of PHP5 has been so slow. The snail&#8217;s pace at which web hosts are migrating to PHP5 has been hampered not by lack of user interest, but because a few popular PHP applications (OSCommerce, for one) break under PHP5. In this respect, I suppose the web host&#8217;s hands are tied.</p>
<p>Coming from a Flash background, where upgrades to the authoring program, programming language and player are frequent, I wonder whether PHP might have something to learn from Flash.</p>
<p>The Flash Player is backwards compatible with old Flash content. Flash Player 8 will play content published in Flash 6 format, even though the two have a vastly different programming language (Actionscript 1.0, and Actionscript 2.0). This can be achieved because a Flash swf contains metadata identifying its minor and major version. As soon as the Flash Player opens a swf file, it can check to see what version of Flash player it has been published for, and treat the swf accordingly.</p>
<p>Why can&#8217;t a PHP file have similar metadata? For instance, a PHP file might begin:</p>
<p><code>&lt;?php4</code></p>
<p>Identifying to the rendering engine to treat the file as PHP4. If a version identifier wasn&#8217;t present, it would treat the file as belonging to the latest version.</p>
<p>OK, so I admit I know next to nothing about the inner workings of PHP, and the solution I&#8217;ve outlined may be totally impossible to implment. But you can&#8217;t blame a frustrated user for taking a stab!</p>
]]></content:encoded>
			<wfw:commentRss>http://f6design.com/journal/2006/07/28/a-flash-perspective-on-php-releases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
