Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: php print forbidden directory contents  (Read 3141 times)

0 Members and 1 Guest are viewing this topic.

diablo416

    Topic Starter


    Hopeful
    • Experience: Beginner
    • OS: Unknown
    php print forbidden directory contents
    « on: December 13, 2008, 05:27:45 PM »

    Just wondering if this is possible,  i use the rack111.com webhost i have a free account and i couldnt find anyway to give guests permission to access the folders individually , i chmod them all but only the files are accessible, for example.. http://aurai.rack111.com/upload/ wont show the directory contents , instead i get 403 forbidden,  i cant set the permissions for this..  so how can i work around it?

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: php print forbidden directory contents
    « Reply #1 on: December 14, 2008, 05:58:17 AM »
    Use this script:

    Code: [Select]
    <?php

    $dir 
    "upload/";
    $files scandir($dir);

    foreach(
    $files as $key => $value)
    {
      echo 
    $value;
    }

    ?>


    diablo416

      Topic Starter


      Hopeful
      • Experience: Beginner
      • OS: Unknown
      Re: php print forbidden directory contents
      « Reply #2 on: December 14, 2008, 11:12:04 AM »
      thanks kpac, it works..


      Just one last thing i cant figure out, in the script you posted..  After echo $value
      i need to include   
      ;
      So that it may print each filename to a new line..

      <?php

      $dir = "upload/";
      $files = scandir($dir);

      foreach($files as $key => $value)
      {
        echo $value 
      ;

       
      }

      ?>


      But i cant get it working?? i know this should be simple but ive tryed it a few different ways without any success ??

      diablo416

        Topic Starter


        Hopeful
        • Experience: Beginner
        • OS: Unknown
        Re: php print forbidden directory contents
        « Reply #3 on: December 14, 2008, 11:26:46 AM »
        nevermind i figured it out , forgot the .
        thanks again

        kpac

        • Web moderator
        • Moderator


        • Hacker

        • kpac®
        • Thanked: 184
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 7
        Re: php print forbidden directory contents
        « Reply #4 on: December 14, 2008, 11:55:20 AM »
        Good. Glad you got it working. ;)