note 42522 added to ref.dir
| From: | david at rn2 dot php dot net | Date: | Wed, 19 May 2004 23:04:43 +0000 |
| Subject: | note 42522 added to ref.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69854@lists.php.net to get a copy of this message | ||
a little juiced up version of turgon64´s script.
before the $moverse was getting very long if you where doing a lot of moving around in directorys
and also i was unable to open files.
also, now you´re not able to move above the specified path
<?php
$path = "./";
if (strrpos($moverse,'..')) {
$moverse = str_replace('/..','',$moverse);
$moverse = substr($moverse,0,strrpos($moverse,'/'));
}
if($moverse) $moverse = $moverse."/";
echo $moverse.'<br>';
$handle=opendir($path.$moverse);
while ($file = readdir($handle)) {
if(is_dir($path.$moverse.$file) && $file != ".") {
if ($file == ".." && $moverse == "") {
} else {
echo "<a
href='?moverse=".$moverse.$file."'>".$file."</a><br>";
}
} else if ($file != ".") {
echo "<a
href='".$path.$moverse.$file."'>".$file."</a><br>";
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.dir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42522
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42522&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42522&report=yes
Search -- http://master.php.net/manage/user-notes.php