Jump to content

directory listing:


chrismarsden2011

Recommended Posts

directory listing:

 

hi guys, im using a PHP script to output a list of documents in different directory's using a single index.php (apart from the style obv), its not a major issue but bugging me as to how to get it to ignore the "up" link for directory navigation. its outputting the below:

 

.

 

..

 

this is annoying me... is it possible to get it to ignore these and not output them?

 

<link rel="stylesheet" type="text/css" href="style.css"> 
<span class="note">
<?php
echo "directoryname3";
?></span>
<?php
$dir="directoryname3"; 
if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
?>

<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}
?>

<br><br>
<span class="note">
<?php
echo "<b>directoryname3</B>";
?></span>

<?php

$dir="directoryname3"; 

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>
<br><br>
<span class="note">
<?php
echo "<b>directoryname3</B>";
?></span>

<?php

$dir="directoryname3"; 

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>
<br><br>
<span class="note">
<?php
echo "<b>directoryname</B>";
?></span>

<?php

$dir="directoryname"; 

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>

Link to comment
https://forums.phpfreaks.com/topic/247713-directory-listing/
Share on other sites

<link rel="stylesheet" type="text/css" href="style.css"> 
<span class="note">
<?php
echo "directoryname3";
?></span>
<?php
$dir="directoryname3"; 
if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
if(in_array($filename,array('..','.')) { continue; }
?>

<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}
?>

<br><br>
<span class="note">
<?php
echo "<b>directoryname3</B>";
?></span>

<?php

$dir="directoryname3"; 

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
if(in_array($filename,array('..','.')) { continue; }
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>
<br><br>
<span class="note">
<?php
echo "<b>directoryname3</B>";
?></span>

<?php

$dir="directoryname3"; 

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
if(in_array($filename,array('..','.')) { continue; }
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>
<br><br>
<span class="note">
<?php
echo "<b>directoryname</B>";
?></span>

<?php

$dir="directoryname"; 

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
if(in_array($filename,array('..','.')) { continue; }
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>

Link to comment
https://forums.phpfreaks.com/topic/247713-directory-listing/#findComment-1272019
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.