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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.