Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: text/plain');
- $ftpmount = '/home/php/ftp/';
- $localstorage = '/home/php/local/';
- function copyFilesScanFolders($folder)
- {
- global $ftpmount;
- global $localstorage;
- $content = scandir ($folder);
- foreach ($content as $file)
- {
- if (($file != '.') && ($file != '..') && ($file != '...'))
- {
- if (!(is_file ($file)))
- {
- copyFilesScanFolders ($folder . $file);
- }
- else
- {
- die($file);
- $fileinfo = pathinfo($_GET['download']);
- $file = $fileinfo['basename'];
- $folder = str_replace($file, '', $_GET['download']);
- $file = addcslashes(addslashes($file), ' ');
- exec ('cp ' . $folder . $file . ' ' . $localstorage . $file . ' -v 2>&1', $output);
- foreach ($output as $line)
- {
- echo $line . '<br />' . PHP_EOL;
- }
- }
- }
- }
- }
- if (is_dir($_GET['download']))
- {
- copyFilesScanFolders($_GET['download']);
- }
- else
- {
- $fileinfo = pathinfo($_GET['download']);
- $file = $fileinfo['basename'];
- $folder = str_replace($file, '', $_GET['download']);
- $file = addcslashes(addslashes($file), ' ');
- exec ('cp ' . $folder . $file . ' ' . $localstorage . $file . ' -v 2>&1', $output);
- foreach ($output as $line)
- {
- echo $line . '<br />' . PHP_EOL;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement