Protect your Folders that do not have an index file.
Some of your folders (like images) do not have any index file, this means if a snooper or even just a customer should happen to call your images folder they will be able to see all of your images and folders contained within. This can be a security and a business problem, security as you might be open to a hacking attempt, business as someone can take all of your images, a real problem if they are of value. What can you do to prevent this?
We have a free script here for you! Copy it and paste it into notepad or your favourite text editor make the necessary changes save it as index.php and upload it to the folders that you want to add some protection to.
What it does...
When someone, anyone including you tries to access the folders you protected the script is brought into action and displays a message to the user explaining they have wandered into a protected are and their IP number and user agent is going to be reported to the store owner, you then receive an e mail letting you know that someone has tried to load the folder in question, this does also mean that when you add a product or edit one you will receive a mail telling you that you have tried to load the folder! It’s that good. It does not do any more than that, unlike our IP trap below but it’s a good extra line of protection for your site.
Here's the code!
*********************************************
<?php
// Written to let you know when someone
// enters a directory they should not be in
// for this to work you need to name this file index.php
// there must be no other index page in the directory
// if and when someone tries to gain your directory they will be
// served a message and you will be e-mailed to let you know some has tried
// GNU open source licence applies
?>
<HTML>
<HEAD>
<title> 404 Error Page</title>
</HEAD>
<BODY>
<p align="center">
<h1>Error 404</h1><br>Page Not Found
<?php
$ip = getenv ("REMOTE_ADDR");
$requri = getenv ("REQUEST_URI");
$servname = getenv ("SERVER_NAME");
$combine = $ip . " tried to load " . $servname . $requri;
$httpref = getenv ("HTTP_REFERER");
$httpagent = getenv ("HTTP_USER_AGENT");
$today = date("D M j Y g:i:s a T");
//Change the message below to suit your needs
$note = "You are not not welcome in this directory, store owners have been notified, your IP number has been recorded.";
$message = "$today n
<br>
$combine <br> n
User Agent = $httpagent n
<h2> $note </h2>n
<br> $httpref ";
$message2 = "$today n
$combine n
User Agent = $httpagent n
$note n
$httpref ";
$to = "you@yoursite.com"; // Change to your e-mail address
$subject = "yourdomain Error Page";
$from = "From: you@yoursite.comrn"; //Change to your own e-mail address
mail($to, $subject, $message2, $from);
echo $message;
?>
</BODY></HTML>
********************************************* |