<?php
  include("connect.php");
  $result=mysql_query("select * from downloads where id='".$id."'",$link);
  $row=mysql_fetch_array($result);
  mysql_free_result($result);
  disconnect();
  $real_file=$row["real_file"];
  $local_file="../admin/files/".$row["local_file"];
  $size_file=$row["size_file"];
  header("Pragma: public");
  header("Expires: 0");
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Content-Type: application/octet-stream");
  header("Content-Length: ".$size_file);
  header("Content-Disposition: inline; filename=".$real_file);
  header("Content-Transfer-Encoding: binary");
  //readfile("../admin/files/".$row["local_file"]);
  $fp=fopen($local_file,"rb");
  $pdf_buffer=fread($fp,$size_file);
  fclose($fp);
  print $pdf_buffer;
  exit;
?>
