Password Protection Script
An HTML trick for your folder customizations. (Password Protection Script)
I may have mentioned this in another post (something about IE and viewing the contents of your C: drive), but I might as well spread it over here where it is more likely to get to people who want to use it. I also shortened the code. Go to the bottom of this post for some discussion on the weaknesses of using this script.
I hope you have a fair understanding of HTML / JavaScript, otherwise you may be lost...
1) Go to a folder you want to password protect
2) Go to View > Customize This Folder...
3) Click Next, And Select a Template To EDIT that resembles the layout you would like to use.
4) In Win2k, find the function Load(). For Win98, find Init(). I may have these function names wrong, so if in doubt, find the <BODY> tag. Find the function called during "onload()".
5) Put your password protecting code at the top of the previously said function. Don't overwrite the default code under it, or else you won't be able to load the folder correctly. If you do, UNDO, or cancel. You can always restart by REMOVING CUSTOMIZATIONS, and then starting at step 1 again.
Example Code:
var FolderPassword = "mypass";
if ( FolderPassword != prompt("Password:") ) {
alert("Incorrect Password!");
return 1;
}
6) Save the edited file.
7) Finish. Now, when you load this folder, it will prompt you for a password. If it is incorrect, then it will end the function early (return 1;) and will not get to the code to display the contents of the folder.
Don't count on this as the best line of security - there are many simple ways around it. Windows 98 for example, allows you to switch out of "View As WebPage" mode really easily. For Windows2k, as far as I know, it takes more work, but the user can simply Remove Customizations, and have a default folder view. Also - your password is stored in plaintext inside the FolderPassword variable. You can also still access this folder without requiring a password - such as through Command Prompt, or with the Open File dialogue.
I have only tested this on Windows 2000, and am not 100% sure if it will work on previous versions of windows, or on XP - but it should work.
black_death - thanks for bringing that command to my attention. I would have never known of it otherwise. With this, I can finally stop going through a whole ton of subdirectories.
-Tim_axe