The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Please Help! – Locked Files

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #45373

    in the “Display Styled Directory Contents”

    **I posted:**

    Finding this made my day!!! thank you soo much. I am having 1 problem if anyone knows. I added the code

    Check out this Pen!

    // Set Forbidden Files
    $forbiddenExts = array(“php”, “ico”, “html”, “LCK”, “js”);

    // Gets Each Entry
    while($entryName = readdir($myDirectory)) {
    $exts = explode(“.”, $entryName);
    if(!in_array($exts[1],$forbiddenExts)) {
    $dirArray[] = $entryName;

    I password protected the directory so each file has a “LCK” file. When i added that extension to the “$forbiddenExts” line but they still show up. If I add “pdf” to the code then the pdf files and the pdf.LCK file are hidden. I only want to hide the LCK file. Any ideas?

    I did add “IndexIgnore *.LCK” to my .htaccess file but now that i am using this they show up again. please help!


    You need to explain this more clearly.

    From what I understand of your problem, yes, adding an extension (e.g., `LCK`) to the `$forbiddenExts` array will prevent files with those extensions from being added to the `$dirArray` array (provided there is exactly one `.` in the filename).

    > I only want to hide the LCK file.

    Meaning any file that ends in `.LCK`, correct? You don’t care about anything else?

    // all files in $myDirectory not ending in “.LCK”
    $dirArray = glob( $myDirectory.’/*.[!L][!C][!K]’ );

    Only thing you might need to change is to remove the `/` in the pattern if your var `$myDirectory` already ends with one.

    I don’t understand the rest of what you wrote.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.