form('op') ){ case "getfile": if( $modules_info[$module_name]["permessi"] == 'rw' ){ $file = $html->form('file'); $backup = file_get_contents( $backup_dir.$file ); header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"".$file."\""); echo $backup; exit; } break; case "del": if( $modules_info[$module_name]["permessi"] == 'rw' ){ $file = $html->form('file'); if( preg_match("/\.zip$/", $file) ){ if( @unlink($backup_dir.$file) ){ array_push( $_SESSION['infos'], "File di backup \"".$file."\" eliminato!" ); header("Location: ".$rootdir."/controller.php?id_module=".$id_module); exit; } else{ array_push( $_SESSION['errors'], "Errore durante l'eliminazione del file di backup \"".$file."\"!" ); header("Location: ".$rootdir."/controller.php?id_module=".$id_module); exit; } } else{ if( @deltree($backup_dir.$file) ){ array_push( $_SESSION['infos'], "Cartella di backup \"".$file."\" eliminata!" ); header("Location: ".$rootdir."/controller.php?id_module=".$id_module); exit; } else{ array_push( $_SESSION['errors'], "Errore durante l'eliminazione della cartella di backup \"".$file."\"!" ); header("Location: ".$rootdir."/controller.php?id_module=".$id_module); exit; } } } break; case "backup": if( $modules_info[$module_name]["permessi"] == 'rw' ){ if( do_backup() ){ header("Location: ".$rootdir."/controller.php?id_module=".$id_module); //header("Location: ".$rootdir."/controller.php?id_module=1"); exit; } else{ array_push( $_SESSION['errors'], "Errore durante la creazione del backup! Verifica che la cartella \"".$backup_dir."\" abbia i permessi di scrittura!" ); header("Location: ".$rootdir."/controller.php?id_module=".$id_module); exit; } } break; } ?>