Files
VestaCP/web/download/backup/index.php

27 lines
737 B
PHP
Raw Normal View History

2012-06-28 14:11:35 +03:00
<?php
// Init
error_reporting(NULL);
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
$backup = $_GET['backup'];
// Check if the backup exists
if (!file_exists($backup)) {
exit(0);
}
2012-06-28 14:11:35 +03:00
// Data
if ($_SESSION['user'] == 'admin') {
header('Content-type: application/gzip');
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
header("X-Accel-Redirect: /backup/" . $backup);
}
if ((!empty($_SESSION['user'])) && ($_SESSION['user'] != 'admin')) {
2015-11-23 23:37:01 +09:00
if (strpos($backup, $user.'.') === 0) {
2012-06-28 14:11:35 +03:00
header('Content-type: application/gzip');
header("Content-Disposition: attachment; filename=\"".$backup."\";" );
header("X-Accel-Redirect: /backup/" . $backup);
}
}