<?php
################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- #
## --------------------------------------------------------------------------- #
## ApPHP AdminPanel Pro #
## Developed by: ApPHP <hide@address.com> #
## License: GNU LGPL v.3 #
## Site: http://www.apphp.com/php-adminpanel/ #
## Copyright: ApPHP AdminPanel (c) 2006-2011. All rights reserved. #
## #
################################################################################
session_start();
if(!(isset($_SESSION['adm_logged']) && ($_SESSION['adm_logged'] == true))){
header("Location: ../index.php");
exit;
}
require_once("../inc/functions.inc.php");
$st = isset($_GET['st']) ? $_GET['st'] : "";
$fname = isset($_GET['fname']) ? remove_bad_chars($_GET['fname'], "medium") : "";
$archive_file_name = "db-backup-".$fname.".sql.zip";
$archive_file_path = "../tmp/backup/";
// check for hacking attacks
if($st == "download"){
if(strlen($fname) > 50){
echo "Can not find backup file or wrong backup file name! Please try again later.";
exit(0);
}
if (@file_exists($archive_file_path.$archive_file_name))
{
// strlen() added for security reasons
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
header("Content-type: application/force-download");
header('Content-Disposition: inline; filename="'.$archive_file_name.'"');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($archive_file_path.$archive_file_name));
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$archive_file_name.'"');
readfile($archive_file_path.$archive_file_name);
}
else
{
///echo "Can not find such path: $archive_file_path.$archive_file_name!";
echo "Can not find backup file! Please try again later.";
}
}
exit(0);
?>