note 49788 added to function.is-dir

From: Date: Tue, 08 Feb 2005 19:55:23 +0000
Subject: note 49788 added to function.is-dir
Groups: php.notes 
Request: Send a blank email to php-notes+get-84681@lists.php.net to get a copy of this message
this function bypasses open_basedir restrictions. <? function my_is_dir($dir) { // bypasses open_basedir restrictions of is_dir and fileperms $tmp_cmd = ls -dl $dir; $dir_flag = $tmp_cmd[0]; if($dir_flag!="d") { // not d; use next char (first char might be 's' and is still directory) $dir_flag = $tmp_cmd[1]; } return ($dir_flag=="d"); } ?> example: <? .... echo is_dir("/somewhere/i/dont/have/access/to"); ?> output: Warning: open_basedir restriction in effect <? .... echo my_is_dir("/somewhere/i/dont/have/access/to"); ?> output: true (or false, depending whether it is or not...) --- visit puremango.co.uk for other such wonders ---- Manual Page -- http://www.php.net/manual/en/function.is-dir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49788 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49788&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49788&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49788&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49788&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49788&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49788&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84681) next »