fileops.php 468 B

1234567891011121314151617181920212223
  1. <?php
  2. function data_mkdir($path,$newdir){
  3. $filteredpath = realpath($GLOBALS["conf"]["data_basedir"]."/".trim($path));
  4. if(strpos($filteredpath, $GLOBALS["conf"]["data_basedir"]) === FALSE){
  5. return FALSE; // noooo
  6. } else {
  7. $absnewdirpath = $filteredpath."/".trim($newdir);
  8. if (!file_exists($absnewdirpath)) {
  9. if (!mkdir($absnewdirpath, 0755, true)) {
  10. return FALSE;
  11. } else {
  12. return TRUE;
  13. }
  14. } else {
  15. return FALSE;
  16. }
  17. }
  18. }
  19. ?>