note 83369 added to function.glob
| From: | hazemaboali at gmail dot com | Date: | Thu, 22 May 2008 16:01:25 +0000 |
| Subject: | note 83369 added to function.glob | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139618@lists.php.net to get a copy of this message | ||
<?
FUNCTION glob2($i)
{
$input = explode('/',$i); $count = count($input);
if($count>=2)
{
$i = 0;
while(++$i < $count)
{ if(is_dir($input[$i-1]))
$directory[] = $input[$i-1];
}
$dir = join('/',$directory);
}else{
$dir = './';
}
$db = opendir($dir);
$output = array();
while(($file = readdir($db))!= false)
{
if(preg_match("#".$input[$count-1]."#",$file))
$output[] = $file;
}
@closedir($db);
return $output;
}
$dir = glob2("upload/.*\.php");
print_r($dir);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 62.139.173.135
----
Manual Page -- http://www.php.net/manual/en/function.glob.php
Edit -- https://master.php.net/note/edit/83369
Del: integrated -- https://master.php.net/note/delete/83369/integrated
Del: useless -- https://master.php.net/note/delete/83369/useless
Del: bad code -- https://master.php.net/note/delete/83369/bad+code
Del: spam -- https://master.php.net/note/delete/83369/spam
Del: non-english -- https://master.php.net/note/delete/83369/non-english
Del: in docs -- https://master.php.net/note/delete/83369/in+docs
Del: other reasons-- https://master.php.net/note/delete/83369
Reject -- https://master.php.net/note/reject/83369
Search -- https://master.php.net/manage/user-notes.php