Public paste
Undefined
By: Guest | Date: Apr 12 2008 20:09 | Format: PHP | Expires: never | Size: 1.07 KB | Hits: 1452

  1. <?php
  2. require_once('config.php');
  3. function escape($post) {
  4.     if (is_numeric($post))
  5.         $toret = mysql_real_escape_string($post);
  6.     else $toret = "'".mysql_real_escape_string($post)."'";
  7.     return $toret;
  8. }
  9. $id = $_GET['id'];
  10.  
  11. if (!is_numeric($id))
  12.         $id = 1;
  13.  
  14. $fulllink = 'http://www.verzameldepreken.nl/uploads/';
  15.  
  16. $sql = mysql_query("SELECT * from preken WHERE id = $id");
  17.         if (mysql_num_rows($sql)) {
  18.      while ($row = mysql_fetch_assoc($sql)) {
  19.         $hits = ($row['hits']+1);
  20.         $hits_db = escape($hits);
  21.         mysql_query ("UPDATE preken SET hits = $hits_db WHERE id = $id");
  22.         $download = '/uploads/'.$row['link'];
  23.     header("Pragma: public");
  24.     header("Expires: 0");
  25.     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  26.     header("Cache-Control: public");
  27.     header("Content-Description: File Transfer");
  28.     header("Content-type: audio/mpeg");
  29.     $header="Content-Disposition: attachment; filename=".$download.";";
  30.     header($header );
  31.     header("Content-Transfer-Encoding: binary");
  32.  
  33.      }
  34.                
  35.         }
  36.        
  37. ?>