PHP Force Download file corrupt
[php:novice]I am using a php script to download a file 
php <br>
$status=stripos($_SERVER['HTTP_REFERER'],'servername'); <br>
if($status===false) <br>
{ <br>
  header('Location:http://xyz.com); <br>
} <br>
else <br>
{ <br>
header('Content-disposition: attachment; filename=XXX.pdf');<br>
header('Content-type: application/pdf');<br>
readfile('http://www.xyz.com/Downloads/XXX.pdf);<br>
} <br>
However when i download the file in any browser it says it is corrupt.

Please Help!
PHP Force Download file corrupt
===

[php:novice]I am using a php script to download a file 
php <br>
$status=stripos($_SERVER['HTTP_REFERER'],'servername'); <br>
if($status===false) <br>
{ <br>
  header('Location:http://xyz.com); <br>
} <br>
else <br>
{ <br>
header('Content-disposition: attachment; filename=XXX.pdf');<br>
header('Content-type: application/pdf');<br>
readfile('http://www.xyz.com/Downloads/XXX.pdf);<br>
} <br>
However when i download the file in any browser it says it is corrupt.

Please Help!