1

I have used usercake to make a login system, I am now altering it to suit my needs.

Originally I a list dir setup on the page to show all of the "help files" within a specific folder. It worked fine but it was not secure and anyone could view. So I have changed my security but am now having a few problems with my code:

//Links for logged in user
if(isUserLoggedIn()) {


    //Links for permission level 3 (BOF)
    if ($loggedInUser->checkPermission(array(3))){

    if ($handle = opendir('CD500/')) {
    while (false !== ($file = readdir($handle)))
        {
            if ($file != '.' && $file != '..'){
             $thelist .= '<a href="/CD500/'.$file.'' target='_blank' >'.$file.'</a></br>';
            }
        }

    closedir($handle);
    } 

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

This is the whole completed package. I am wondering if its simple as too many if statements?

It does not parse, the html loads and images appear but this just never materializes.

I set up:

//Links for logged in user
if(isUserLoggedIn()) {


    //Links for permission level 3 (BOF)
    if ($loggedInUser->checkPermission(array(3))){


    foreach(glob('./BOF/*.*') as $filename){


    echo $filename ;

    }



} 

My only problem whilst this works, is to make it presentable which I have so far failed to do.

I would Ideally like to fix the first solution, if not how can I style the second?

Marriott81
  • 275
  • 2
  • 16

1 Answers1

1

This line

$thelist .= '<a href="/CD500/'.$file.'' target='_blank' >'.$file.'</a></br>';

Should be

$thelist .= '<a href="/CD500/'.$file.'" target="_blank" >'.$file.'</a></br>';
SajithNair
  • 3,867
  • 1
  • 17
  • 23
  • have edited it, it still just gives me a blank screen, pictures and background load but the text still fails, it works If i put it directly on the page, but this page is being called to another if the user is logged in. – Marriott81 Mar 06 '14 at 09:35
  • turns out had a : not a ;, however its stopped parsing my html now. one works the other does not =\ – Marriott81 Mar 06 '14 at 09:49
  • Also you can have a +1 on question for introducing me to the phplogs – Marriott81 Mar 06 '14 at 09:52