<?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>Webmaster Blog &#187; PHP</title>
	<atom:link href="http://www.chuckun.co.uk/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chuckun.co.uk</link>
	<description>Webmaster Blog brought to you by Chuckun!</description>
	<lastBuildDate>Thu, 01 Dec 2011 16:39:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>PHP Version Requirement Scanner</title>
		<link>http://www.chuckun.co.uk/2011/08/webmaster-resources/php-version-requirement-scanner/</link>
		<comments>http://www.chuckun.co.uk/2011/08/webmaster-resources/php-version-requirement-scanner/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 20:27:23 +0000</pubDate>
		<dc:creator>Chuckun</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Special Articles]]></category>
		<category><![CDATA[Webmaster Resources]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.chuckun.co.uk/?p=234</guid>
		<description><![CDATA[Check PHP files for minimum PHP version requirement A very useful tool for many of you looking to release your scrips to the public, will be this PHP minimum version requirement checker. If you ever plan on selling or distributing scripts, it&#8217;s vital that you let your customers know the server requirements of your scripts. [...]


Related posts:<ol><li><a href='http://www.chuckun.co.uk/2011/06/featured/securing-downloadable-files-with-php-2/' rel='bookmark' title='Securing downloadable files with PHP'>Securing downloadable files with PHP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON-->
<!-- google_ad_section_start -->
<!--INFOLINKS_ON-->
<p><h3>Check <acronym title="Pre-Hypertext Processing">PHP</acronym> files for minimum <acronym title="Pre-Hypertext Processing">PHP</acronym> version requirement</h3>
<p>A very useful tool for many of you looking to release your scrips to the public, will be this <acronym title="Pre-Hypertext Processing">PHP</acronym> minimum version requirement checker.</p>
<p>If you ever plan on selling or distributing scripts, it&#8217;s vital that you let your customers know the server requirements of your scripts.  Whilst telling them that your script might use the mod_rewrite Apache Module, or that it requires MySQL database, will be fairly easy to know, figuring out the <acronym title="Pre-Hypertext Processing">PHP</acronym> version requirements of your script is not straight forward, and certainly not an easy task if your script is quite complex.</p>
<p>Doing so would require that you write down EVERY <acronym title="Pre-Hypertext Processing">PHP</acronym> function that you use in your script, and then cross-reference to php.net to see what versions can use each function.</p>
<p>Well, say goodbye to that idea thanks to PHPduck!  These amazing folks have created the script for the job!</p>
<p>Find out all about it here: <a href="http://phpduck.com/minimum-php-version-script/" rel="nofollow" target="_blank">http://phpduck.com/minimum-php-version-script/</a></p>
<p>And view an example results page here: <a href="http://phpduck.com/resources/minVersion_vBulletin401.html" rel="nofollow" target="_blank">http://phpduck.com/resources/minVersion_vBulletin401.html</a></p>
<!--INFOLINKS_OFF-->
<!-- google_ad_section_end -->
<p><map name='google_ad_map_234_95208805c0710682'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/234?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_234_95208805c0710682' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=234&amp;url=http%3A%2F%2Fwww.chuckun.co.uk%2F2011%2F08%2Fwebmaster-resources%2Fphp-version-requirement-scanner%2F' title="PHP Version Requirement Scanner" alt=" PHP Version Requirement Scanner" /></p><!--INFOLINKS_OFF--><img src="http://www.chuckun.co.uk/?ak_action=api_record_view&id=234&type=feed" alt=" PHP Version Requirement Scanner"  title="PHP Version Requirement Scanner" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.chuckun.co.uk%2F2011%2F08%2Fwebmaster-resources%2Fphp-version-requirement-scanner%2F&amp;title=PHP%20Version%20Requirement%20Scanner" id="wpa2a_2"><img src="http://www.chuckun.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 PHP Version Requirement Scanner"  title="PHP Version Requirement Scanner" /></a></p>

<p>Related posts:<ol><li><a href='http://www.chuckun.co.uk/2011/06/featured/securing-downloadable-files-with-php-2/' rel='bookmark' title='Securing downloadable files with PHP'>Securing downloadable files with PHP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.chuckun.co.uk/2011/08/webmaster-resources/php-version-requirement-scanner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Securing downloadable files with PHP</title>
		<link>http://www.chuckun.co.uk/2011/06/featured/securing-downloadable-files-with-php-2/</link>
		<comments>http://www.chuckun.co.uk/2011/06/featured/securing-downloadable-files-with-php-2/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 15:53:48 +0000</pubDate>
		<dc:creator>Chuckun</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Special Articles]]></category>
		<category><![CDATA[Webmaster Resources]]></category>
		<category><![CDATA[downloads]]></category>
		<category><![CDATA[secure]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.chuckun.co.uk/?p=222</guid>
		<description><![CDATA[Today, I&#8217;ll be showing you how you can easily protect your downloadable media. Why would you want to do this? Well, often we want to hide the location of the downloads, to stop people leeching your content. And most measures can be easily swerved. Here is a method I quite like. I have annotated everything [...]


Related posts:<ol><li><a href='http://www.chuckun.co.uk/2011/08/webmaster-resources/php-version-requirement-scanner/' rel='bookmark' title='PHP Version Requirement Scanner'>PHP Version Requirement Scanner</a></li>
<li><a href='http://www.chuckun.co.uk/2011/10/featured/scan-all-files-for-strings-variables-using-cmd-exe/' rel='bookmark' title='Scan all files for strings / variables using CMD.exe'>Scan all files for strings / variables using CMD.exe</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<!--INFOLINKS_ON-->
<!-- google_ad_section_start -->
<!--INFOLINKS_ON-->
<p><p>Today, I&#8217;ll be showing you how you can easily protect your downloadable media.</p>
<p>Why would you want to do this? Well, often we want to hide the location  of the downloads, to stop people leeching your content.  And most  measures can be easily swerved.</p>
<p>Here is a method I quite like.  I have annotated everything for your convenience.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Filename: download.php</p>

<div class="my_syntax_box"><span class="my_syntax_selecall"><a href="javascript:;" onclick="selectCode(this); return false;">Selec All</a> </span><span class="my_syntax_Bar">Code:</span><div class="my_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;downloaded.zip&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// this is the fake name you want the downloaded file to be called.</span>
<span style="color: #000088;">$source</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/downloads/thefile.zip&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// this is the real name and location of the file.</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// check that the real file exists, if so do the following..</span>
&nbsp;
   <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-type: application/zip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// set the content type of the current page to the type of file being downloaded</span>
   <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Disposition: attachment; filename=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$filename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Forge the download name by setting filename=</span>
   <span style="color: #990000;">readfile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// grab the real file to prompt download.</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// if the file doesn't exist</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Error: File not found!&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// display error message</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div></div>

<p>So how do we use this? going to the destination: mysite.com/download.php  would grab the file &#8216;thefile.zip&#8217; from the /downloads/ folder, and  prompt you to download it, but with a new name of &#8216;downloaded.zip&#8217;</p>
<p>This is the simplest version of this method.  Obviously with use of  $_GET requests you can have download.php choose varying files from the  /downloads/ folder.  Example below:</p>
<p>Filename: download.php</p>

<div class="my_syntax_box"><span class="my_syntax_selecall"><a href="javascript:;" onclick="selectCode(this); return false;">Selec All</a> </span><span class="my_syntax_Bar">Code:</span><div class="my_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;downloaded-&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.zip&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// will forge the name downloaded-5.zip (if download.php?file=5 is requested)</span>
<span style="color: #000088;">$source</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/downloads/thefile-&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.zip&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// will pick the real file titled thefile-5.zip (if download.php?file=5 is requested)</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// check that the real file exists, if so do the following..</span>
&nbsp;
   <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-type: application/zip'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// set the content type of the current page to the type of file being downloaded</span>
   <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Disposition: attachment; filename=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$filename</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Forge the download name by setting filename=</span>
   <span style="color: #990000;">readfile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// grab the real file to prompt download.</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// if the file doesn't exist</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Error: File not found!&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// display error message</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div></div>

<p>It gets even more advanced once you start playing with more and more  security.  When dealing with premium ($$$) content, it&#8217;s good to use a  database and give all your files a masked name, by MD5 encoding the  names, storing them in a database with an assigned ID, and having  download.php retreive the filename from the database to know which file  to retreive.  But that&#8217;d look a little messy for this tutorial!</p>
<p>I hope you learned something by reading this..</p>
<p>Thanks for reading!</p>
<!--INFOLINKS_OFF-->
<!-- google_ad_section_end -->
<p><map name='google_ad_map_222_95208805c0710682'>
<area shape='rect' href='http://imageads.googleadservices.com/pagead/imgclick/222?pos=0' coords='1,2,367,28' />
<area shape='rect' href='http://services.google.com/feedback/abg' coords='384,10,453,23'/></map>
<img usemap='#google_ad_map_222_95208805c0710682' border='0' src='http://imageads.googleadservices.com/pagead/ads?format=468x30_aff_img&amp;client=&amp;channel=&amp;output=png&amp;cuid=222&amp;url=http%3A%2F%2Fwww.chuckun.co.uk%2F2011%2F06%2Ffeatured%2Fsecuring-downloadable-files-with-php-2%2F' title="Securing downloadable files with PHP" alt=" Securing downloadable files with PHP" /></p><!--INFOLINKS_OFF--><img src="http://www.chuckun.co.uk/?ak_action=api_record_view&id=222&type=feed" alt=" Securing downloadable files with PHP"  title="Securing downloadable files with PHP" /><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.chuckun.co.uk%2F2011%2F06%2Ffeatured%2Fsecuring-downloadable-files-with-php-2%2F&amp;title=Securing%20downloadable%20files%20with%20PHP" id="wpa2a_4"><img src="http://www.chuckun.co.uk/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="share save 171 16 Securing downloadable files with PHP"  title="Securing downloadable files with PHP" /></a></p>

<p>Related posts:<ol><li><a href='http://www.chuckun.co.uk/2011/08/webmaster-resources/php-version-requirement-scanner/' rel='bookmark' title='PHP Version Requirement Scanner'>PHP Version Requirement Scanner</a></li>
<li><a href='http://www.chuckun.co.uk/2011/10/featured/scan-all-files-for-strings-variables-using-cmd-exe/' rel='bookmark' title='Scan all files for strings / variables using CMD.exe'>Scan all files for strings / variables using CMD.exe</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.chuckun.co.uk/2011/06/featured/securing-downloadable-files-with-php-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

