PHP 8.5.0 Alpha 1 available for testing

Voting

: zero minus zero?
(Example: nine)

The Note You're Voting On

puremango dot co dot uk at gmail dot com
20 years ago
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

<< Back to user notes page

To Top