index.php 758 B

1234567891011121314151617181920212223242526
  1. <?php
  2. // Init
  3. error_reporting(NULL);
  4. session_start();
  5. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  6. $backup = basename($_GET['backup']);
  7. // Check if the backup exists
  8. if (!file_exists('/backup/'.$backup)) {
  9. exit(0);
  10. }
  11. // Data
  12. if ($_SESSION['user'] == 'admin') {
  13. header('Content-type: application/gzip');
  14. header("Content-Disposition: attachment; filename=\"".$backup."\";" );
  15. header("X-Accel-Redirect: /backup/" . $backup);
  16. }
  17. if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
  18. if (strpos($backup, $user.'.') === 0) {
  19. header('Content-type: application/gzip');
  20. header("Content-Disposition: attachment; filename=\"".$backup."\";" );
  21. header("X-Accel-Redirect: /backup/" . $backup);
  22. }
  23. }