<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How To Force File Download With PHP</title>
	<atom:link href="http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/</link>
	<description>A blog about web development, software business, and WordPress</description>
	<lastBuildDate>Wed, 08 Feb 2012 21:10:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: swellendam accommodation</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-180174</link>
		<dc:creator>swellendam accommodation</dc:creator>
		<pubDate>Mon, 19 Sep 2011 16:37:36 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-180174</guid>
		<description>&lt;strong&gt;swellendam accommodation...&lt;/strong&gt;

[...]How To Force File Download With PHP &#124; W-Shadow.com[...]...</description>
		<content:encoded><![CDATA[<p><strong>swellendam accommodation&#8230;</strong></p>
<p>[...]How To Force File Download With PHP | W-Shadow.com[...]&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WuFe</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-176005</link>
		<dc:creator>WuFe</dc:creator>
		<pubDate>Tue, 06 Sep 2011 17:12:23 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-176005</guid>
		<description>Goosy, the cURL method to retrieve the file size doesn&#039;t work ever.
The best function to retrieve the size of a remote file is this:

function remotefilesize( $url ){
    $size = get_headers( $url, 1 );
    $size = $size[ &quot;Content-Length&quot; ];
    return $size;
}

Anyway thanks a lot for the snippet..</description>
		<content:encoded><![CDATA[<p>Goosy, the cURL method to retrieve the file size doesn&#8217;t work ever.<br />
The best function to retrieve the size of a remote file is this:</p>
<p>function remotefilesize( $url ){<br />
    $size = get_headers( $url, 1 );<br />
    $size = $size[ "Content-Length" ];<br />
    return $size;<br />
}</p>
<p>Anyway thanks a lot for the snippet..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: goosy</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-173157</link>
		<dc:creator>goosy</dc:creator>
		<pubDate>Tue, 23 Aug 2011 08:55:59 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-173157</guid>
		<description>Thanks a lot !!! Just more things for force download on cross -domain 
delte this line &quot;if(!is_readable($file)) die(&#039;File not found or inaccessible!&#039;);&quot; and for the file size use curl method like above 
// Create a curl connection
$chGetSize = curl_init();
 
// Set the url we&#039;re requesting
curl_setopt($chGetSize, CURLOPT_URL, &quot;http://www.example.com/file.exe&quot;);
 
// Set a valid user agent
curl_setopt($chGetSize, CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11&quot;);
 
// Don&#039;t output any response directly to the browser
curl_setopt($chGetSize, CURLOPT_RETURNTRANSFER, true);
 
// Don&#039;t return the header (we&#039;ll use curl_getinfo();
curl_setopt($chGetSize, CURLOPT_HEADER, false);
 
// Don&#039;t download the body content
curl_setopt($chGetSize, CURLOPT_NOBODY, true);
 
// Run the curl functions to process the request
$chGetSizeStore = curl_exec($chGetSize);
$chGetSizeError = curl_error($chGetSize);
$chGetSizeInfo = curl_getinfo($chGetSize);
 
// Close the connection
curl_close($chGetSize);// Print the file size in bytes
 
$size=$chGetSizeInfo[&#039;download_content_length&#039;];

thx again !</description>
		<content:encoded><![CDATA[<p>Thanks a lot !!! Just more things for force download on cross -domain<br />
delte this line &#8220;if(!is_readable($file)) die(&#8216;File not found or inaccessible!&#8217;);&#8221; and for the file size use curl method like above<br />
// Create a curl connection<br />
$chGetSize = curl_init();</p>
<p>// Set the url we&#8217;re requesting<br />
curl_setopt($chGetSize, CURLOPT_URL, &#8220;http://www.example.com/file.exe&#8221;);</p>
<p>// Set a valid user agent<br />
curl_setopt($chGetSize, CURLOPT_USERAGENT, &#8220;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11&#8243;);</p>
<p>// Don&#8217;t output any response directly to the browser<br />
curl_setopt($chGetSize, CURLOPT_RETURNTRANSFER, true);</p>
<p>// Don&#8217;t return the header (we&#8217;ll use curl_getinfo();<br />
curl_setopt($chGetSize, CURLOPT_HEADER, false);</p>
<p>// Don&#8217;t download the body content<br />
curl_setopt($chGetSize, CURLOPT_NOBODY, true);</p>
<p>// Run the curl functions to process the request<br />
$chGetSizeStore = curl_exec($chGetSize);<br />
$chGetSizeError = curl_error($chGetSize);<br />
$chGetSizeInfo = curl_getinfo($chGetSize);</p>
<p>// Close the connection<br />
curl_close($chGetSize);// Print the file size in bytes</p>
<p>$size=$chGetSizeInfo['download_content_length'];</p>
<p>thx again !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nlayno</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-169760</link>
		<dc:creator>nlayno</dc:creator>
		<pubDate>Wed, 25 May 2011 07:41:04 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-169760</guid>
		<description>how to use this script ?


foredownload.php?file=http://--.zip &lt;- like that?</description>
		<content:encoded><![CDATA[<p>how to use this script ?</p>
<p>foredownload.php?file=http://&#8211;.zip &lt;- like that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vhortex</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-168927</link>
		<dc:creator>vhortex</dc:creator>
		<pubDate>Sun, 24 Apr 2011 14:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-168927</guid>
		<description>@pk1001100011

You don&#039;t need to put full filters on this function, the filters should be added somewhere on your code to prevent bloating your functions.

Provided code is only an example on how to do things.  

I read your website and this is different from the script that you reviewed. 
safe_mode can only be turned on by system admins and not ordinary hosted users unless you have a VPS account or a dedicated account. This function is turned on 97% of the time on shared hosting.

open_basedir is enabled on secured servers and there is no way to activate it on shared hosting accounts. This will cause trouble on account creations due to the restrictions that needs to be applied per account/domain.

open_basedir rule on applies to 1 and 1 domain or subdomain causing errors on the next subdomains that will be created unless you add a new open_basedir  for that subdomain.</description>
		<content:encoded><![CDATA[<p>@pk1001100011</p>
<p>You don&#8217;t need to put full filters on this function, the filters should be added somewhere on your code to prevent bloating your functions.</p>
<p>Provided code is only an example on how to do things.  </p>
<p>I read your website and this is different from the script that you reviewed.<br />
safe_mode can only be turned on by system admins and not ordinary hosted users unless you have a VPS account or a dedicated account. This function is turned on 97% of the time on shared hosting.</p>
<p>open_basedir is enabled on secured servers and there is no way to activate it on shared hosting accounts. This will cause trouble on account creations due to the restrictions that needs to be applied per account/domain.</p>
<p>open_basedir rule on applies to 1 and 1 domain or subdomain causing errors on the next subdomains that will be created unless you add a new open_basedir  for that subdomain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flor</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-168795</link>
		<dc:creator>Flor</dc:creator>
		<pubDate>Sat, 16 Apr 2011 20:40:23 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-168795</guid>
		<description>amm i don&#039;t know why but when the window to save the file opens  the file is downloaded like this  &quot;-myFile.pdf-&quot;, i mean the extension is changed for .pdf-  so it downloads corrupted or imposible to open any idea why this happens???</description>
		<content:encoded><![CDATA[<p>amm i don&#8217;t know why but when the window to save the file opens  the file is downloaded like this  &#8220;-myFile.pdf-&#8221;, i mean the extension is changed for .pdf-  so it downloads corrupted or imposible to open any idea why this happens???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaGenious</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-147805</link>
		<dc:creator>JavaGenious</dc:creator>
		<pubDate>Mon, 20 Dec 2010 10:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-147805</guid>
		<description>Thanks for the info. Can you also provide an example of use for this method?</description>
		<content:encoded><![CDATA[<p>Thanks for the info. Can you also provide an example of use for this method?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn Deprey</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-135843</link>
		<dc:creator>Shawn Deprey</dc:creator>
		<pubDate>Fri, 03 Dec 2010 03:52:18 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-135843</guid>
		<description>What a great script! Very easy to follow. I hate when script writers cannot realize that they need to make their code easy to follow if they want other people to comprehend it. I used your script here:

http://www.pixnorth.com/phplx/mycode.php

You can use the php tools to add to the &quot;my code&quot; section. Your script then makes it possible to export to a php script whatever is in that section. Thanks for the script!</description>
		<content:encoded><![CDATA[<p>What a great script! Very easy to follow. I hate when script writers cannot realize that they need to make their code easy to follow if they want other people to comprehend it. I used your script here:</p>
<p><a href="http://www.pixnorth.com/phplx/mycode.php" rel="nofollow">http://www.pixnorth.com/phplx/mycode.php</a></p>
<p>You can use the php tools to add to the &#8220;my code&#8221; section. Your script then makes it possible to export to a php script whatever is in that section. Thanks for the script!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ozzie Bock</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-129013</link>
		<dc:creator>Ozzie Bock</dc:creator>
		<pubDate>Tue, 23 Nov 2010 06:16:09 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-129013</guid>
		<description>Thank you for posting this article, it really helped when I needed to force download a connection program for our remote pc support business.</description>
		<content:encoded><![CDATA[<p>Thank you for posting this article, it really helped when I needed to force download a connection program for our remote pc support business.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pk1001100011</title>
		<link>http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/comment-page-5/#comment-71462</link>
		<dc:creator>pk1001100011</dc:creator>
		<pubDate>Mon, 02 Aug 2010 15:29:29 +0000</pubDate>
		<guid isPermaLink="false">http://w-shadow.com/blog/2007/08/12/how-to-force-file-download-with-php/#comment-71462</guid>
		<description>This script sucks. There are three vulnerabilities in this script: Local File Inclusion, Remote File Inclusion and Directory Traversal. These vulnerabilities allow an attacker to e.g read /etc/passwd file or steal a cookie. First of all, you should filter user supplied data.
I wrote a blog post about this: http://pklog.jogger.pl/2010/07/20/pewien-hotel-i-local-file-inclusion-studium-przypadku/ . It&#039;s not English - Polish. You can use Google Translate or only look at code.
Anyway, just read about LFI, RFI, DT and white lists.

Finally, I&#039;m sorry for my English - it&#039;s not my native language.</description>
		<content:encoded><![CDATA[<p>This script sucks. There are three vulnerabilities in this script: Local File Inclusion, Remote File Inclusion and Directory Traversal. These vulnerabilities allow an attacker to e.g read /etc/passwd file or steal a cookie. First of all, you should filter user supplied data.<br />
I wrote a blog post about this: <a href="http://pklog.jogger.pl/2010/07/20/pewien-hotel-i-local-file-inclusion-studium-przypadku/" rel="nofollow">http://pklog.jogger.pl/2010/07/20/pewien-hotel-i-local-file-inclusion-studium-przypadku/</a> . It&#8217;s not English &#8211; Polish. You can use Google Translate or only look at code.<br />
Anyway, just read about LFI, RFI, DT and white lists.</p>
<p>Finally, I&#8217;m sorry for my English &#8211; it&#8217;s not my native language.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

