I write programs for people. I write programs that constitute entire sites. These programs/sites
sometimes have thousands of hits per day and thousands of users. This translates into hundreds or
thousands of directories!
What happens if someone calls a URL to a directory where there is no default page? The entire
contents of that directory is displayed!!! Once that happens, who knows what sort of information
a person can obtain ?!?!?!?!?!?
This utility will prevent that. Starting October 1st, 1999, all my new scripts use this utility. I am
slowly going back and adding it to previous scripts. What this utility does is add a default page to
every single directory your script creates! This way, the user is blocked from seeing the contents of
that directory and you didn't have to spend the time creating and uploading hundreds of default pages!
It is very simple to use:
- In your script, you must first 'require' this utility with the following line:
require 'redirect_html.pl';
- Next, at any and EVERY point in your script you create a directory you simply
make the very next line a call to the sub. It only requires one parameter and that
is the absolute path to the directory you want protected.
redirect_html([abs_path_to_directory]);
Here are some examples showing how to use it:
mkdir($directory_path, 0766);
redirect_html($directory_path);
mkdir("/home/usr/html/name/$var/directory", 0777);
redirect_html("/home/usr/html/name/$var/directory");
mkdir('/home/usr/html/data/admin/pass', 0766);
redirect_html('/home/usr/html/data/admin/pass');
DEFAULT PAGE: This utility assumes a default page name of
"index.html". If this is not your servers default page name but rather
it's something like: main.html or index.htm then all you have to do is pass
that page name as a second parameter to the script. i.e.
redirect_html($directory_path, 'default.html');
Full explanation is in the utility documentation.
|