Advertisement
RobinJ1995

Untitled

Jan 1st, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <?php
  2. header('Content-type: text/plain');
  3.  
  4. $ftpmount = '/home/php/ftp/';
  5. $localstorage = '/home/php/local/';
  6.  
  7. function copyFilesScanFolders($folder)
  8. {
  9. global $ftpmount;
  10. global $localstorage;
  11.  
  12. $content = scandir ($folder);
  13. foreach ($content as $file)
  14. {
  15. if (($file != '.') && ($file != '..') && ($file != '...'))
  16. {
  17. if (!(is_file ($file)))
  18. {
  19. copyFilesScanFolders ($folder . $file);
  20. }
  21. else
  22. {
  23. die($file);
  24. $fileinfo = pathinfo($_GET['download']);
  25. $file = $fileinfo['basename'];
  26. $folder = str_replace($file, '', $_GET['download']);
  27. $file = addcslashes(addslashes($file), ' ');
  28.  
  29. exec ('cp ' . $folder . $file . ' ' . $localstorage . $file . ' -v 2>&1', $output);
  30.  
  31. foreach ($output as $line)
  32. {
  33. echo $line . '<br />' . PHP_EOL;
  34. }
  35. }
  36. }
  37. }
  38. }
  39.  
  40. if (is_dir($_GET['download']))
  41. {
  42. copyFilesScanFolders($_GET['download']);
  43. }
  44. else
  45. {
  46. $fileinfo = pathinfo($_GET['download']);
  47. $file = $fileinfo['basename'];
  48. $folder = str_replace($file, '', $_GET['download']);
  49. $file = addcslashes(addslashes($file), ' ');
  50.  
  51. exec ('cp ' . $folder . $file . ' ' . $localstorage . $file . ' -v 2>&1', $output);
  52.  
  53. foreach ($output as $line)
  54. {
  55. echo $line . '<br />' . PHP_EOL;
  56. }
  57. }
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement