How to protect your Forum by Password
There are some ways to put a password to your page.
A simple password-script would be viewable in the page's source.
You may choose to put the JavaScript to an external file.
Password-Protection is just a suggestion, the much easier and more effective
way to hide your forum is to create a Network54 Group and give access to
the (registered) group regulars.
The exact way how to create groups is illustrated
here.
• A Simple Script
To paste to your forum (Header or Footer)
<script language="JavaScript">
<!--
var password = "secret";
pwd = window.prompt("Password","");
if(pwd != password)
{
alert("That word "+pwd+" is wrong !");
location.href="http://www.network54.com/Hide/Forum/xxxxxx;
}
if(pwd == password)
{
alert("Congratulations.. this is it!");
}
// -->
</script>
Before your forum is fully loaded a little prompt will pop up.
There your visitors have to write the password.(here: secret)
The script makes it so that if the right word was written you'll
get an "Alert-Box" with confirmation (Congratulations... this is it).
Of course you can change the text to anything else.
In case of a wrong word a 'Denied'(That word xxx is wrong! -
can be changed to your own words, too) prompts, and re-direct to
a location of your choice. I would suggest your forum URL to have a second chance.
Change xxxxxx to your forum No.
Note: If your forum's source is viewed the password is easy to grap!
But really worse is having that password prompt at ANY site of your forum. Very annoying! I guess some cookies will do here.. I'll have to look for a different script.
A Safer But More Difficult Way
In this case I've used a script wich takes you to an "Entry" page
by using the file-name as password, therefore the actual password is
not viewable in your forum's source.
On that second page you will be asked again to enter a password
in a prompt to access at last your protected forum.
You can use the same word or a different, just adapt the script then.
If the password given there is wrong
it will re-direct back to the password-page.
• Getting Started:
Create a Realm. Create 2 HTML-files.
Name your first page password.html.
This will be the URL you give to others to enter your forum.
In this case this is my page:
http://network54.com/Realm/n54_files/password.html
Name the second file just like the password you want to use.
In my example, the password is "secret"
so the HTML file is named
secret.html. :-)
Copy the script below to your "password" page.
Note 1: This will only work if you or your posters don't give away the forum's URL.
Note 2: Be aware that search engines like Google nevertheless grabb anything
which is written in your forum and perhaps publish it.
password.html
Put this script between <HEAD> and </HEAD> to your password.html-page
<script language="JavaScript">
<!--
function loadpage(){ document.location.href=document.frm.pswd.value + ".html"
}
//-->
</script> Write this code within the <BODY>-tags :
<center>
<form name="frm">
<p>Password 1: <input type="text" name="pswd" size="20">
<input type="button" value="Enter Password 1 and Click" onClick="loadpage()">
</p>
</form>
</center>
secret.html
Put this code to your protected site from where to enter the forum:
The script will re-direct everybody who did write the wrong password - to another site.
(That's the location.href-part of the script, choose your own direction-URL to
where the user is re-directed in case of an error or a wrong password.
<script language="JavaScript">
<!--
var password = "secret";
pwd = window.prompt("Password","");
if(pwd != password)
{
alert("That word "+pwd+" is wrong !");
location.href="http://network54.com/Realm/n54_files/password.html";
}
if(pwd == password)
{
alert("Congratulations... this is it!");
}
// -->
</script>
1/2004 © Ed Home/BilgeRat

