Jump to content

Hide all files with same extension in PHP file directory?


carmi

Recommended Posts

 

Hi Gusy,

Would be great if you can help me to sort this out and Thank you in advance.

 

I would like to hide all files with "swf" extension from my file and folder directory,

I know how to hide one specific file but not ll files with same extension. For example: *.swf.

 

Here is my code which is work for full file names but not all files with same extension.

 

<?php

$filearray = array();

if ($handle = opendir('.')) {

while (false !== ($file = readdir($handle))) {

if ($file != "." && $file != ".." && $file != ".htaccess" && $file != "index.php" && $file != "style.css" && $file != "Images" && $file != "*.swf" && $file != "index.html") {

$filearray[] = $file;

}

}

closedir($handle);

natcasesort($filearray);

foreach($filearray as $f) {

$thelist .= '<img width="15" height="15" alt="[DIR]" src="/Images/folder.jpg"> <a href="'.$f.'">'.$f.'</a>

';

}

}

?>

 

As you can see I have "&& $file != "*.swf"" which need your advise in this part.

 

I just want people not seeing all .SWF files in the index directory of my server.

I have already have index.html inside my folder as well which has been hided because of "$file != "index.html"". But this is not hiding my ".SWF" files.

 

Many Thanks.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.