1

I am using Usercake which will allow me to protect my page unless you are logged in, which works as expected.

I then wrote some code to show me the directory of a file, this also works as expected.

Currently they both work individually. However, I want to combine them so that my directory listing is protected along with the login menu.

I have tried setting the output as an echo and displaying it under the if logged in script (something which I think is along the right lines). Its just not working, have been at it for a few hours now.

Am I missing something obvious?

<?php
 if ($handle = opendir('BOF/')) {
   while (false !== ($file = readdir($handle)))
      {
          if ($file != "." && $file != ".."){
            $thelist .= '<ul><a href="/BOF/'.$file.'" target="_blank" 

style="color: #0f33cc">'.$file.'</a></ul>';
          }
       }
  closedir($handle);
  } 


require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}


echo"

<ul id='options'>";

include("left-nav3.php");

echo "

</ul>"


echo "
<div id='output'>
List of help files:</div>
<div id='List'>
<?=$thelist

</div>"

?>

This is the state I have left it in before coming to you guys and gals for help.

I am betting I have missed something obvious and that is why it will not work, probably because they wont combine or something in the IF statement.

Marriott81
  • 275
  • 2
  • 16

0 Answers0