Advertisement
realgunnaz

Untitled

Dec 19th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. <?php
  2. include('checkfiles.php');
  3. session_start();
  4. $filename = 'uploads/'.$_SESSION['user_name']. '/'.$_GET['$searchfol'];
  5.  
  6. if (file_exists($filename)) {
  7. echo "The file exists" .$_GET['$searchfol'];;
  8. } else {
  9. mkdir('uploads/'.$_SESSION['user_name']. '/'.$_GET['$searchfol'], 0700);
  10. echo "The folder has been created";
  11. }
  12.  
  13. create new folder
  14. _____________________________________________________________________________________________________________
  15.  
  16. <?php
  17. include('checkfiles.php');
  18. session_start();
  19. $filename = 'uploads/'.$_SESSION['user_name']. '/'.$fileqw;
  20. $wrongfile= 'uploads/'.$_SESSION['user_name']. '/'.$fileqw. '/';
  21. if(file_exists($wrongfile))
  22. {
  23. echo "Cannot delete folders :Only files";
  24. }
  25. else if (file_exists($filename)) {
  26. unlink('uploads/'.$_SESSION['user_name']. '/'.$fileqw);
  27. echo "Files has been deleted";
  28. }
  29. ?>
  30.  
  31. delete files
  32. _________________________________________________________________________________________________________________
  33.  
  34. <?php
  35. include('checkfiles.php');
  36. session_start();
  37. $filename = 'uploads/'.$_SESSION['user_name']. '/'.$fileqw. '/';
  38. if (file_exists($filename)) {
  39. rmdir('uploads/'.$_SESSION['user_name']. '/'.$fileqw. '/');
  40. echo "The folder has been deleted";
  41. } else {
  42. echo "Error, This is only for removing folders";
  43. }
  44. ?>
  45.  
  46. delete folders
  47. __________________________________________________________________
  48.  
  49. download
  50.  
  51. <?php
  52. include('checkfiles.php');
  53. session_start();
  54. $file = basename($_GET['file']);
  55. $file = 'uploads/'.$_SESSION['user_name']. '/'.$fileqw;
  56.  
  57. if(!$file){
  58. die('file not found');
  59. } else {
  60. header("Cache-Control: public");
  61. header("Content-Description: File Transfer");
  62. header("Content-Disposition: attachment; filename=$file");
  63. header("Content-Type: application/zip");
  64. header("Content-Transfer-Encoding: binary");
  65.  
  66. // read the file from disk
  67. readfile($file);
  68. }
  69. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement