SHARE
TWEET

PHP permission test

a guest Dec 24th, 2015 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <h1>Start test</h1>
  2. <hr>
  3. <?php
  4.  
  5. permitted($_SERVER['DOCUMENT_ROOT']);
  6.  
  7. function permitted($dir) {
  8.   foreach (scandir($dir) as $file) {
  9.  
  10.     if (substr($file, 0, 1) !== '.') {
  11.  
  12.       if (is_writable($file)) {
  13.         print $file.' [PERMS: '.fileperms($file).']<br />';
  14.       } else {
  15.         print '<span style="color:red;">'.$file.'</span><br />';
  16.       }
  17.  
  18.       if (is_dir($file)) {
  19.         print '<h4>DIR:'.$file.'</h4><div style="margin:0 0 12px 12px;">';
  20.         permitted($file);
  21.         print '</div>';
  22.       }
  23.     }
  24.  
  25.   }
  26. }
  27.  
  28. ?>
  29. <hr>
  30. <h1>The end</h1>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top