0) {
$backup_cmd = 'tar --create --verbose --gzip --file '.$tmp.$filename.' --directory / ';
foreach ($a_backup as $ent) {
if ($ent['enabled'] =="true"){
//htmlspecialchars($ent['name']);
//htmlspecialchars($ent['path']);
//htmlspecialchars($ent['description']);
$backup_cmd .= htmlspecialchars($ent['path']).' ';
}
$i++;
}
//echo $backup_cmd; //exit;
system($backup_cmd);
}
session_cache_limiter('public');
$fd = fopen($tmp.$filename, "rb");
header("Content-Type: binary/octet-stream");
header("Content-Length: " . filesize($tmp.$filename));
header('Content-Disposition: attachment; filename="'.$filename.'"');
fpassthru($fd);
exit;
}
}
if ($_GET['a'] == "other") {
if ($_GET['t'] == "restore") {
$tmp = '/root/backup/';
$filename = 'pfsense.bak.tgz';
//extract the tgz file
if (file_exists('/root/backup/'.$filename)) {
//echo "The file $filename exists";
system('cd /; tar xvpfz /root/backup/'.$filename.' ');
header( 'Location: backup.php?savemsg=Backup+has+been+restored.' ) ;
}
else {
header( 'Location: backup.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
}
exit;
}
}
if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) {
$filename = 'pfsense.bak.tgz';
move_uploaded_file($_FILES['ulfile']['tmp_name'], "/root/backup/" . $filename);
$savemsg = "Uploaded file to /root/backup/" . htmlentities($_FILES['ulfile']['name']);
system('cd /; tar xvpfz /root/backup/'.$filename.' ');
}
include("head.inc");
?>