note 71881 added to function.scandir
| From: | (at) | Date: | Thu, 21 Dec 2006 02:16:05 +0000 |
| Subject: | note 71881 added to function.scandir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120812@lists.php.net to get a copy of this message | ||
hello all,
when i list my directories in html i can click the images
but i can't click the directories, it states i don't have permission, although i chmod my
folders in question to 777 to test.
any info on this please?
changed a bit to the code this doesn't use the javascript go function that was not added.
the code i found here in this topic was :
<?php
function ls_recursive2($dir)
{
if (is_dir($dir))
{
$files = scandir($dir);
foreach ($files as $file)
{
$currentfile = $dir . "/" . $file;
$last_dir = "";
// Calculate they identation.
$count = substr_count($currentfile, '/');
$minus_count = substr_count($_SERVER['DOCUMENT_ROOT'], '/');
$count -= ($minus_count + 2);
for($p = 0; $p < $count; $p++)
{
$last_dir .= " ";
}
if (is_dir($currentfile))
{
if ($file != '.' && $file != '..')
{
$last_dir .= "<img src='images/folder.gif' alt=''
align='middle' width='16' height='16'
border='0'> <a href='$currentfile' \"> ".
substr($currentfile, strrpos($currentfile, '/')) . "</a><br>";
echo $last_dir;
ls_recursive2($currentfile);
}
}
else
{
$last_dir .= "<img src='images/file.gif' alt=''
align='middle' width='16' height='16'
border='0'> <a href='$currentfile' \"> ".
substr($currentfile, strrpos($currentfile, '/')) . "</a><br>";
echo $last_dir;
}
}
}
}
?>
<?php
ls_recursive2(".");
?>
----
Server IP: 87.238.162.147
Probable Submitter: 81.165.145.200
----
Manual Page -- http://www.php.net/manual/en/function.scandir.php
Edit -- https://master.php.net/note/edit/71881
Del: integrated -- https://master.php.net/note/delete/71881/integrated
Del: useless -- https://master.php.net/note/delete/71881/useless
Del: bad code -- https://master.php.net/note/delete/71881/bad+code
Del: spam -- https://master.php.net/note/delete/71881/spam
Del: non-english -- https://master.php.net/note/delete/71881/non-english
Del: in docs -- https://master.php.net/note/delete/71881/in+docs
Del: other reasons-- https://master.php.net/note/delete/71881
Reject -- https://master.php.net/note/reject/71881
Search -- https://master.php.net/manage/user-notes.php