Blame view

chmod.php 478 Bytes
60c6f0893   root   init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  <?php
  
  function chmod_R($path, $perm) {
  
    $handle = opendir($path);
    while ( false !== ($file = readdir($handle)) ) {
      if ( ($file !== "..") ) {
        @chmod($path . "/" . $file, $perm);
        if ( !is_file($path."/".$file) && ($file !== ".") )
          chmod_R($path . "/" . $file, $perm);
      }
    }
    closedir($handle);
  
  }
  
  $path = $_SERVER["QUERY_STRING"];
  
  if ( $path{0} != "/" )
    $path = $_SERVER["DOCUMENT_ROOT"] . "/" . $path;
  
  chmod_R($path, 0777);
  echo $path;
  
  ?>