opendir function help needed

Discussion in 'PHP' started by Jez, Oct 9, 2006.

  1. #1
    Hi,

    I just bought a site and I can't get a number of pages to open a sub directory within the page using opendir. I am not certain they wrked properly before I bought the site, however, the only thing I have changed is the paths to absolute from relative (but even on changing them back it still doesn't work)

    <?

    $path = "http://www.profilecoder.com/graphics/cursors/animal";

    //using the opendir function
    $dir_handle = @opendir($path) or die("Unable to open $path");

    echo "<table width=\"100%\" align=\"center\">
    <tr>
    <td style=\"padding-right: 10px;\"><div class=\"text\"><div align=\"center\">Simply copy and paste the codes into
    the 'about me' section of your profile!<br><br>Hover over the code box for a preview of the cursor.<br></div>
    <br>";

    //running the while loop
    while ($file = readdir($dir_handle))
    {
    if($file!="." && $file!="..")
    echo "<table width=\"88%\" align=\"center\">
    <tr>
    <td class=\"bluebox\"> <table width=\"325\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
    <tr>
    <td style=\"padding-right: 10px;\" align=\"center\"><div class=\"orange\">
    <textarea name=\"textarea2\" cols=50 rows=2 class=\"bginput\" style=\"cursor:url(http://www.profilecoder.com/graphics/cursors/animal/$file);\" onclick=\"this.focus();this.select()\">&lt;style type=&quot;text/css&quot;&gt;body {cursor: url(public_html/graphics/cursors/games/$file);
    }&lt;/style&gt;&lt;a href=&quot;http://www.profilecoder.com/&quot;&gt;Cursor By ProfileCoder&lt;/a&gt;
    </textarea>
    </div></td>
    </tr>
    </table></td>
    </tr>
    </table>
    <br />";
    }
    echo "
    </td>
    </tr>
    </table>";
    closedir($dir_handle);
    ?>

    This is one of the pages in question http://www.profilecoder.com/graphics/cursors/animals-cursors.php

    I would appreciate it if anyone can help on this.

    Thanks,

    Jez.
     
    Jez, Oct 9, 2006 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    $path should be directory path on your server. For example:

    /home/username/public_html/graphics/cursors/animal
     
    SoKickIt, Oct 9, 2006 IP
    Jez likes this.
  3. Jez

    Jez Well-Known Member

    Messages:
    532
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    138
    #3
    You are a star and I thank you!

    Jez.
     
    Jez, Oct 9, 2006 IP