<?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>Under Development :: Life in the Virtual World &#187; PHP &amp; MySQL</title>
	<atom:link href="http://underdevelopment.maravillaclan.net/category/php-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://underdevelopment.maravillaclan.net</link>
	<description>Learning to do it a little better</description>
	<lastBuildDate>Wed, 09 Dec 2009 12:23:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flash CMS v0.0.1</title>
		<link>http://underdevelopment.maravillaclan.net/2009/03/19/flash-cms-v001/</link>
		<comments>http://underdevelopment.maravillaclan.net/2009/03/19/flash-cms-v001/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 12:19:53 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=217</guid>
		<description><![CDATA[This was a proof of concept we sent to our client requesting dynamic content for Flash media plus a web based editor for the content.
At first glance it seems as if they are asking for something that could take months to develop. However, it&#8217;s actually simple enough that could be done by patching one component [...]]]></description>
			<content:encoded><![CDATA[<p>This was a proof of concept we sent to our client requesting dynamic content for Flash media plus a web based editor for the content.</p>
<p>At first glance it seems as if they are asking for something that could take months to develop. However, it&#8217;s actually simple enough that could be done by patching one component from another. Done with one cup of coffee.</p>
<p>Flash supports HTML. But don&#8217;t get too excited. Flash only supports some basic tags. All you need then is to be able to push data to it. You could do this with several methods. One would be using LoadVars. Another one is the good old FlashVars and lastly through XML.</p>
<p>With this example we&#8217;re using LoadVars. Below are the only lines of codes you need to do a simple CMS.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Simple just declare a text area contains an HTML markup</span>
_root.<span style="color: #660066;">content</span>.<span style="color: #660066;">html</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Load the content</span>
<span style="color: #003366; font-weight: bold;">var</span> contentVars <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> LoadVars<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
contentVars.<span style="color: #000066;">onLoad</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ok<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>ok<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    _root.<span style="color: #660066;">content</span>.<span style="color: #660066;">htmlText</span> <span style="color: #339933;">=</span> contentVars.<span style="color: #660066;">flash_content</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// load the file (use .php extension to avoid browsers from caching the content)</span>
<span style="color: #006600; font-style: italic;">// no worries cause the content is encoded and no php script</span>
<span style="color: #006600; font-style: italic;">// could be executed with this process</span>
contentVars.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;flash_content.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// this is just to keep flash from running away</span>
<span style="color: #000066;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>You might wonder why not just use Flash XML feature instead of LoadVars. Well that could be done also. It&#8217;s just what I felt doing at the time. Also since I was using php as my file extension XML might not be the right choice as it exposes some security holes.</p>
<p>Next step is the What-You-See-Is-What-You-Get editor (WYSIWYG). There are lots available in the net. For this example I used <a href="http://tinymce.moxiecode.com/" target="_blank">TinyMCE</a>. You would need to configure or do some hack to make the editor only use the tags supported by Flash. List of supported tags could be found in <a href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14808" target="_blank">http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14808.</a></p>
<p>Once you get that done next step is to push the content of the editor to Flash. This is where PHP plays its role. Of course you could use other server side scripting in place of it.</p>
<p>The result would be something like <a title="Flash CMS sample" href="http://webtools.maravillaclan.net/flash_cms/" target="_blank">this (Flash CMS sample)</a>. Go ahead and try it. You may also download the source files to modify and maybe improve it.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2009/03/19/flash-cms-v001/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Filter non-numeric characters</title>
		<link>http://underdevelopment.maravillaclan.net/2008/12/24/filter-non-numeric-characters/</link>
		<comments>http://underdevelopment.maravillaclan.net/2008/12/24/filter-non-numeric-characters/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 03:51:53 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP & MySQL]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=103</guid>
		<description><![CDATA[Usually when creating a scraper or a simple parser we encounter data that are usually not as clean as we expected it to be. For example We should be parsing only the sale price but the label gets in the way. These codes could be useful for the purpose of filtering out unwanted characters.
Integers:

$dirty_data = [...]]]></description>
			<content:encoded><![CDATA[<p>Usually when creating a scraper or a simple parser we encounter data that are usually not as clean as we expected it to be. For example We should be parsing only the sale price but the label gets in the way. These codes could be useful for the purpose of filtering out unwanted characters.</p>
<h2>Integers:</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dirty_data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'You\'re now 26 years old'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$clean_integer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[^0-9]&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dirty_data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// $clean_integer = '26';</span></pre></div></div>

<h2>Decimals:</h2>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dirty_data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Sale price : $12.45'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$clean_dec</span> <span style="color: #339933;">=</span>  <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[^0-9.]&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dirty_data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// $clean_dec = '12.45';</span></pre></div></div>

<p>This would also do good on prefomating a phone number if you only want numbers but your users adds dashes or spaces in between.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2008/12/24/filter-non-numeric-characters/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Inserting records from a SELECT statement (MySQL)</title>
		<link>http://underdevelopment.maravillaclan.net/2008/09/09/inserting-records-from-a-select-statement-mysql/</link>
		<comments>http://underdevelopment.maravillaclan.net/2008/09/09/inserting-records-from-a-select-statement-mysql/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 06:32:20 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=68</guid>
		<description><![CDATA[I often forget even simple syntax that makes MySQL operation easy. I&#8217;m just adding this basically for personal reference.
Using INSERT statement combined with the SELECT statement you could actually add records from one table to another table. Adding a WHERE clause could enable you to filter the records to copy. Below is the syntax.

INSERT INTO [...]]]></description>
			<content:encoded><![CDATA[<p>I often forget even simple syntax that makes MySQL operation easy. I&#8217;m just adding this basically for personal reference.</p>
<p>Using INSERT statement combined with the SELECT statement you could actually add records from one table to another table. Adding a WHERE clause could enable you to filter the records to copy. Below is the syntax.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> table_destination <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> table_source <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">WHERE</span> condition<span style="color: #66cc66;">&#93;</span>;</pre></div></div>

<p>However this generic statement only works if the two tables have the same order of columns and has compatible data types. If that is not the case you would need to specify the columns like the following syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> table_destination <span style="color: #66cc66;">&#40;</span>column_1<span style="color: #66cc66;">,</span> column_2<span style="color: #66cc66;">,</span> column_3<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> column_1<span style="color: #66cc66;">,</span> column_2<span style="color: #66cc66;">,</span> column_3 <span style="color: #993333; font-weight: bold;">FROM</span> table_source <span style="color: #66cc66;">&#91;</span><span style="color: #993333; font-weight: bold;">WHERE</span> condition<span style="color: #66cc66;">&#93;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2008/09/09/inserting-records-from-a-select-statement-mysql/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>NOT id IN (1, 2, 3) vs NOT (id IN (1, 2, 3))</title>
		<link>http://underdevelopment.maravillaclan.net/2008/09/05/not-id-in-1-2-3-vs-not-id-in-1-2-3/</link>
		<comments>http://underdevelopment.maravillaclan.net/2008/09/05/not-id-in-1-2-3-vs-not-id-in-1-2-3/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 05:23:00 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=59</guid>
		<description><![CDATA[Problem:
You&#8217;re probably wondering why the following query doesn&#8217;t  work on some mySQL databases
SELECT * FROM table1 WHERE NOT id IN (1, 2, 3)
works on mySQL v5.0.51a
doesn&#8217;t work on mySQL v4.1.21
Solution:
The reason is that the query would confuse the older version what to evaluate by NOT.
This query generally works.
SELECT * FROM table1 WHERE NOT (id IN [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong></p>
<p>You&#8217;re probably wondering why the following query doesn&#8217;t  work on some mySQL databases</p>
<p><span style="color: #0000ff;">SELECT</span> * <span style="color: #0000ff;">FROM</span> <span style="color: #00ff00;">table1 </span><span style="color: #0000ff;">WHERE NOT</span> <span style="color: #00ff00;">id </span><span style="color: #0000ff;">IN</span> (<span style="color: #ff0000;">1</span>, <span style="color: #ff0000;">2</span>, <span style="color: #ff0000;">3</span>)<br />
works on mySQL v5.0.51a<br />
doesn&#8217;t work on mySQL v4.1.21</p>
<p><strong>Solution:</strong><span id="more-59"></span></p>
<p>The reason is that the query would confuse the older version what to evaluate by NOT.</p>
<p>This query generally works.</p>
<p><span style="color: #0000ff;">SELECT</span> * <span style="color: #0000ff;">FROM</span> <span style="color: #00ff00;">table1 </span><span style="color: #0000ff;">WHERE NOT</span> (<span style="color: #00ff00;">id </span><span style="color: #0000ff;">IN</span> (<span style="color: #ff0000;">1</span>, <span style="color: #ff0000;">2</span>, <span style="color: #ff0000;">3</span>))<br />
works on mySQL v5.0.51a<br />
works on mySQL v4.1.21</p>
<p>This is basically just specifying what should value should be evaluated by NOT.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2008/09/05/not-id-in-1-2-3-vs-not-id-in-1-2-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Sample &#8211; RSS v1.0</title>
		<link>http://underdevelopment.maravillaclan.net/2008/08/16/php-sample-rss-v10/</link>
		<comments>http://underdevelopment.maravillaclan.net/2008/08/16/php-sample-rss-v10/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 07:32:53 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Samples]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[rss v1.0]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=12</guid>
		<description><![CDATA[
There are basically three parts you need to be concerned about when generating an RSS v1.0:

The RSS related data
The feeds
The search information

RSS related data
These will be the data that are specific to the whole feed or to the website. These would include the following:

title
link
description
image

Feed Items
These will be items you would want to put on the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://underdevelopment.maravillaclan.net/wp-content/uploads/2008/08/rss_v10_screenshot1.png"><img class="alignnone size-full wp-image-46" title="rss_v10_screenshot" src="http://underdevelopment.maravillaclan.net/wp-content/uploads/2008/08/rss_v10_screenshot1.png" alt="" /></a></p>
<p style="text-align: left;">There are basically three parts you need to be concerned about when generating an RSS v1.0:</p>
<ul style="text-align: left;">
<li>The RSS related data</li>
<li>The feeds</li>
<li>The search information</li>
</ul>
<p style="text-align: left;"><strong>RSS related data</strong></p>
<p style="text-align: left;">These will be the data that are specific to the whole feed or to the website. These would include the following:</p>
<ul style="text-align: left;">
<li>title</li>
<li>link</li>
<li>description</li>
<li>image</li>
</ul>
<p style="text-align: left;"><strong>Feed Items</strong></p>
<p style="text-align: left;">These will be items you would want to put on the RSS Feed. Each Item would include the following:</p>
<ul style="text-align: left;">
<li>title of the article, news, or any other item depending on the use.</li>
<li>description or summary</li>
<li>link to the item page on your website</li>
</ul>
<p style="text-align: left;"><strong>Search information (optional)<br />
</strong></p>
<p style="text-align: left;">Some RSS readers supports search feature for RSS items. You could utilize this by setting up a search script on your host. This would need the following information:</p>
<ul style="text-align: left;">
<li>URL of the search script</li>
<li>title</li>
<li>description</li>
<li>parameter name of the search string variable</li>
</ul>
<p style="text-align: left;">See demo here (<a href="http://underdevelopment.maravillaclan.net/wp-content/uploads/2008/08/sample_rss_v10.php" target="_blank">sample_rss_v1.0</a>).</p>
<p style="text-align: left;">Attached is a simple template that could be used in any application. Like most of my sample template, all the data are hardcoded. They could easily be replaced with data coming from different sources like a database or a scraped html content.</p>
<p style="text-align: left;">Specified header might not be needed but the following could be used:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: application/xml; charset=ISO-8859-1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p style="text-align: left;">I&#8217;m Planning to post another using RSS v2.0.</p>
<p style="text-align: left;"><strong>Attachments:</strong></p>
<p style="text-align: left;"><a href="http://underdevelopment.maravillaclan.net/wp-content/uploads/2008/08/sample_rss_v10.zip">sample_rss_v1.0.zip</a></p>
<p style="text-align: left;"><strong>Reference:</strong></p>
<p style="text-align: left;"><a title="RSS" href="http://en.wikipedia.org/wiki/RSS_(file_format)#RSS_1.0" target="_blank">http://en.wikipedia.org/wiki/RSS_(file_format)#RSS_1.0</a></p>
<p style="text-align: left;">This is the first of many sample templates that I&#8217;ll be posting here. I usually just browse through the web to find templates / sample scripts for different web technologies but sometimes good articles disappear and could never be found. Most of the time clients will ask for added features like RSS feeds, integration to payment gateway, email form, etc. The problem is that is no script available to use that is easy enough to modify.</p>
<p style="text-align: left;">My plan here is to have a repository of simple scripts that could easily be copied and pasted to anywhere. I usually put the code part first and the template part next, so expect it on most of the sample scripts posted here.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2008/08/16/php-sample-rss-v10/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Force Download :: Fixing Safari Download Header Issues</title>
		<link>http://underdevelopment.maravillaclan.net/2007/10/26/php-force-download-fixing-safari-download-header-issues/</link>
		<comments>http://underdevelopment.maravillaclan.net/2007/10/26/php-force-download-fixing-safari-download-header-issues/#comments</comments>
		<pubDate>Fri, 26 Oct 2007 03:42:35 +0000</pubDate>
		<dc:creator>Bong-Bong</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://underdevelopment.maravillaclan.net/?p=5</guid>
		<description><![CDATA[Problem:
We&#8217;d got this client requesting a download script written in PHP. The Script should be able to run in Mozilla Firefox, MS IE, and Safari. Sounds simple enough right? I mean this could simply be done by just sending the following headers:
&#8212;
header(&#8220;Pragma: public&#8221;);
header(&#8220;Expires: 0&#8243;);
header(&#8220;Cache-Control: must-revalidate, post-check=0, pre-check=0&#8243;);
header(&#8220;Cache-Control: private&#8221;,false);
header(&#8220;Content-Transfer-Encoding: binary&#8221;);
header(&#8220;Content-Type: video/x-ms-wmv&#8221;);
header(&#8220;Content-Length: &#8220;.@filesize($filepath));
header(&#8220;Content-Disposition: attachment; filename=\&#8221;".$filename.&#8220;\&#8221;;&#8221;);
&#8212;
We&#8217;ve been using [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong><br />
We&#8217;d got this client requesting a download script written in PHP. The Script should be able to run in Mozilla Firefox, MS IE, and Safari. Sounds simple enough right? I mean this could simply be done by just sending the following headers:<br />
&#8212;<br />
<fontcolor="#0000ff"><font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Pragma: public&#8221;</font><span>);</span><br />
<font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Expires: 0&#8243;</font><span>);</span><br />
<font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Cache-Control: must-revalidate, post-check=0, pre-check=0&#8243;</font><span>);</span><br />
<font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Cache-Control: private&#8221;</font><span>,</span><font color="#0000ff">false</font><span>);</span><br />
<font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Content-Transfer-Encoding: binary&#8221;</font><span>);</span><br />
<font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Content-Type: video/x-ms-wmv&#8221;</font><span>);</span><br />
<font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Content-Length: &#8220;</font><span>.@</span><font color="#0000ff">filesize</font><span>($filepath));</span><br />
<font color="#0000ff">header</font><span>(</span><font color="#ff0000">&#8220;Content-Disposition: attachment; filename=\&#8221;"</font><span>.$filename.</span><font color="#ff0000">&#8220;\&#8221;;&#8221;</font><span>);</span><br />
&#8212;<br />
We&#8217;ve been using this header to force browser to download contents since day one.  We thought nothing was wrong with it. That&#8217;s before we tested it with Safari. For some reason Safari just displays a blank white page. No error messages no nothing.</fontcolor="#0000ff"></p>
<p><strong>Solution:</strong><br />
<span id="more-5"></span></p>
<p>Apparently this is caused by Safari not being able to identify what file it is accessing. It doesn&#8217;t know how to deal with &#8220;video/x-ms-wmv&#8221; with is the mime-type for *.wmv files. The mime-type it recognizes as downloadable would be &#8220;application/octet-stream&#8221;. So by changing the header being passed you would be able to force Safari to download the contents. Of course you&#8217;ll still need to attach the contents after sending the headers. The resulting headers will then be:</p>
<p>&#8212;<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Expires: 0&#8242;</font>);<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Last-Modified: &#8216;</font> .    <font color="#0000ff">gmdate </font>(<font color="#ff0000">&#8216;D, d M Y H:i:s&#8217;</font>, <font color="#0000ff">filemtime </font>($filepath)) . <font color="#ff0000">&#8216; GMT&#8217;</font>);<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Pragma: public&#8217;</font>);<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Cache-Control: must-revalidate, post-check=0, pre-check=0&#8242;</font>);<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Accept-Ranges: bytes&#8217;</font>);<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Content-Length: &#8216;</font> . @<font color="#0000ff">filesize</font>($filepath));<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Content-Type: Application/octet-stream&#8217;</font>);<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Content-Disposition: attachment; filename=&#8221;&#8216; </font>. $filename. <font color="#ff0000">&#8216;&#8221;&#8216;</font>);<br />
<font color="#0000ff">header</font>(<font color="#ff0000">&#8216;Connection: close&#8217;</font>);<br />
&#8212;</p>
<p><strong>Source:</strong><br />
<a href="http://indiegamer.com/archives/t-1953.html" target="_blank">Dexterity Software Forums &#8211; Hiding download path in PHP </a></p>
<p><strong>Note:</strong><br />
I don&#8217;t know why Safari developers haven&#8217;t addressed this issue yet as not all web developers comply with their obsolete method. There are numerous post in the web stating that Safari users are unable to download anything from the web. This is probably cause by URL masking scripts as developers would like to hide the path to their files. Content-type should be indicative and specific to its content. But for the meantime these headers will serve its purpose until Safari and other browsers recognize more mime-types.</p>
]]></content:encoded>
			<wfw:commentRss>http://underdevelopment.maravillaclan.net/2007/10/26/php-force-download-fixing-safari-download-header-issues/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
