Guest User

Untitled

a guest
Mar 2nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1. <?php
  2.  
  3. // check this line first
  4.  
  5. require '/home/solidarity/kr/bbs/include/common.php';
  6. echo "Worked! <P>";
  7.  
  8.  
  9. // comment out everything below
  10.  
  11.  
  12. $user="derp";
  13. $host="localhost";
  14. $password="herp";
  15. $database="dev";
  16.  
  17. $connection = mysql_connect($host,$user,$password)
  18. or die ("couldn't connect to server"); $db = mysql_select_db($database,$connection)
  19. or die ("Couldn't select database");
  20.  
  21. $query .= "SELECT donor FROM bbs_users WHERE id=".$pun_user['id'];
  22. $result = mysql_query($query, $connection) or die
  23. ("Could not execute query : $query ." . mysql_error());
  24.  
  25. $show = $_GET['show'];
  26.  
  27.  
  28. echo "show : $show <p>";
  29.  
  30. $ep = $_GET['ep'];
  31.  
  32. echo "ep: $ep <p>";
  33.  
  34. /*
  35. $directory = '/home/solidarity/private/krdl/';
  36.  
  37. $show2 = $show.'/';
  38.  
  39. echo "show2: $show2 <p>";
  40.  
  41. // local file that should be send to the client
  42. $local_file = $ep;
  43.  
  44. echo "local_file : $local_file <p>";
  45.  
  46. $download = $directory.$show2.$local_file;
  47.  
  48. echo "download: $download <p>";
  49.  
  50. while($process=mysql_fetch_array($result)) {
  51.  
  52. $donor=$process["donor"];
  53.  
  54. echo "donor: $donor <p>";
  55.  
  56. if($donor=="1") {
  57.  
  58.     echo 'inside if($donor=="1")';
  59.  
  60.     header('Content-Type: application/octet-stream');
  61.     header('Content-Disposition: attachment; filename='.$download);
  62.     header('Content-Transfer-Encoding: binary');
  63.     header('Cache-Control: private');
  64.     header('Content-Length: ' . filesize($download));
  65.     ob_clean();
  66.     flush();
  67.     readfile($download);
  68.     exit;
  69. }
  70. }
  71.  
  72. */
  73. ?>
Add Comment
Please, Sign In to add comment