I need to password protect my website.

  • ad
  • Born
  • Born
  • ad
  • Posts: 1

Post 3+ Months Ago

Can someone give me a Java script which I can insert onto my website and only make people with a certain user name which I made and a password, enter.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Try using the following:

Code: [ Select ]
<!-- ONE STEP TO INSTALL LOGIN CODER:

  1. Add the first code into the BODY of your HTML document -->

<!-- STEP ONE: Add the first code into the BODY of your HTML document -->

<BODY>

<center><table border=1>
<tr><form name=members><td rowspan=4>
<select name=memlist size=10 onChange="showmem(this.form)">

<!-- Original: Dion -->
<!-- Web Site: http://www.iinet.net.au/~biab/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- "member name | password | destination pagename |" -->
<option selected value="John Smith|password|mainpage|">John Smith
<option value="Peter Jones|theirpwd|endpages|">Peter Jones
<option value="Sue Brown|asdfvcxz|nowheres|">Sue Brown
<option value="Sally West|zaqxswde|logintop|">Sally West
</select></td>
<td align=right>User:</td><td><input type=hidden value="0" name=entry>
<input type=text name=memname size=8 value=""></td></tr>
<tr><td align=right>Password:</td><td><input type=text name=password size=8 maxlength=8><font size="-1"><-- Must be exactly 8 characters</font></td></tr>
<tr><td align=right>Page Name:</td><td><input type=text name=pagename size=8 maxlength=8><b>.html</b><font size="-1"><-- Must be exactly 8 characters</font></td></tr>
<tr><td colspan=2 align=center>
<input type=button value="New User" onclick="addnew(this.form);">
<input type=button value="Delete User" onclick="delthis(this.form);">
<input type=button value="Update/Show Coding" onclick="update(this.form); create(this.form);"></td></tr>
<tr><td colspan=3 align=center>
<input type=text size=60 name=message value="Note: Password/Page Name must be exactly 8 letters! (a-z)">
<input type=hidden name=num value=1></td>
</form></tr>
</table>
<hr size=2 width=75%>
<form name=js><textarea cols=75 rows=10 name=scrpt wrap=virtual>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var params=new Array(4);
var alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI";
function check(form) {
which=form.memlist.selectedIndex;
choice = form.memlist.options[which].value+"|";
if (choice=="x|") {
alert("Please Select Your Name From The List");
return;
}
p=0;
for (i=0;i<3;i++) {
a=choice.indexOf("|",p);
params[i]=choice.substring(a,p);
p=a+1;
}
h1=makehash(form.pass.value,3);
h2=makehash(form.pass.value,10)+" ";
if (h1!=params[1]) {
alert("Incorrect Password!"); return; };
var page="";
for (var i=0;i<8;i++) {
letter=params[2].substring(i,i+1)
ul=letter.toUpperCase();
a=alpha.indexOf(ul,0);
a-=(h2.substring(i,i+1)*1);
if (a<0) a+=26;
page+=alpha.substring(a,a+1); };
top.location=page.toLowerCase()+".html";
}
function makehash(pw,mult) {
pass=pw.toUpperCase();
hash=0;
for (i=0;i<8;i++) {
letter=pass.substring(i,i+1);
c=alpha.indexOf(letter,0)+1;
hash=hash*mult+c;
}
return(hash);
}
// End -->
</script>
</textarea>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var params=new Array(4);
var script=document.js.scrpt.value;
document.js.scrpt.value="Create your users, their passwords, and their destination pages using the form above.\n\nThen, click 'Show Coding' to see the login HTML and JavaScript that you need to put on your page to password-protect your site with that info.\n\nQuestions about this script or how to put it on your site should be directed to it's author via email: dion@mailhub.omen.com.au\n\n*Honestly, we don't even totally understand this JavaScript!*";
var alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI";
showmem(document.members);
function showmem(form) {
document.members.num.value=document.members.memlist.length;
var which=form.memlist.selectedIndex;
splt(form.memlist[which].value);
form.entry.value=which+1;
for (i=2;i<5;i++) {
form.elements[i].value=params[i-2]; };
}
function splt(choice) {
p=0;
for (i=0;i<3;i++) {
a=choice.indexOf("|",p);
params[i]=choice.substring(a,p);
p=a+1;
  }
}
function addnew(form) {
newmem=getfields(form);
var who=prompt("New User's Name:","");
form.memlist[form.memlist.length] = new Option(who, newmem, false, true);
if (navigator.appName=="Netscape") {
document.js.scrpt.value=script;
history.go(0);
}
else {
showmem(document.members);
  }
}
function getfields(form) {
newmem="";
for (i=2;i<5;i++) {
newmem+=form.elements[i].value+"|"; };
for (i=3;i<5;i++) {
a=form.elements[i];
for (k=0;k<8;k++) {
  }
}
return(newmem);
}
function delthis(form) {
if (confirm("Delete "+form.memname.value+"?")) {
form.memlist.options[form.entry.value-1]=null;
form.message.value=form.memname.value+" Deleted";
form.memlist.selectedIndex=0;
if (navigator.appName=="Netscape") {
document.js.scrpt.value=script;
history.go(0);
}
else {
showmem(document.members);
   }
  }
}
function update(form) {
msg="no";
a=form.elements[i];
for (k=0;k<8;k++) {
b=a.value.substring(k,k+1);
c=b.toUpperCase();
form.memlist[form.entry.value-1].value=getfields(form);
form.message.value=form.memname.value+"'s record was updated";
  }
}
function create(form) {

var html="<center><form name=login>\n";
html+="<table border=1 cellpadding=3>\n\n";
html+="<!-- Original: Dion -->\n";
html+="<!-- Web Site: http://www.iinet.net.au/~biab/ -->\n";
html+="<!-- This script and many more are available free online at -->\n";
html+="<!-- The JavaScript Source!! http://javascript.internet.com -->\n\n";
html+='<tr><td colspan=2 align=center><font size="+2">';
html+='<b>Members-Only Area!</b></font></td></tr>\n';
html+="<tr><td>Username:</td><td><select name=memlist>\n<option value='x'>";
for (j=0;j<form.memlist.length;j++) {
splt(form.memlist.options[j].value);
h1=makehash(params[1],3);
h2=makehash(params[1],10)+" ";
var page="";
for (var i=0;i<8;i++) {
letter=params[2].substring(i,i+1);
ul=letter.toUpperCase();
a=alpha.indexOf(ul,0);
a+=(h2.substring(i,i+1)*1);
page+=alpha.substring(a,a+1);
}
html+="\n<option value='"+params[0]+"|"+h1+"|"+page+"'>"+params[0];
};
html+="\n</select></td></tr>\n";
html+="<tr><td>Password:</td><td><input type=password size=10 maxlength=8 name=pass></td></tr>\n";
html+='<tr><td colspan=2 align=center><input type=button value="Login" onclick="check(this.form)"></td>\n';
html+="</tr>\n</table>\n</form>\n";
document.js.scrpt.value=html+script+"</center>";
}
function makehash(pw,mult) {
pass=pw.toUpperCase();
hash=0;
for (i=0;i<8;i++) {
letter=pass.substring(i,i+1);
c=alpha.indexOf(letter,0)+1;
hash=hash*mult+c;
}
return(hash);
}
// End -->
</script>
</center>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 6.50 KB -->
  1. <!-- ONE STEP TO INSTALL LOGIN CODER:
  2.   1. Add the first code into the BODY of your HTML document -->
  3. <!-- STEP ONE: Add the first code into the BODY of your HTML document -->
  4. <BODY>
  5. <center><table border=1>
  6. <tr><form name=members><td rowspan=4>
  7. <select name=memlist size=10 onChange="showmem(this.form)">
  8. <!-- Original: Dion -->
  9. <!-- Web Site: http://www.iinet.net.au/~biab/ -->
  10. <!-- This script and many more are available free online at -->
  11. <!-- The JavaScript Source!! http://javascript.internet.com -->
  12. <!-- "member name | password | destination pagename |" -->
  13. <option selected value="John Smith|password|mainpage|">John Smith
  14. <option value="Peter Jones|theirpwd|endpages|">Peter Jones
  15. <option value="Sue Brown|asdfvcxz|nowheres|">Sue Brown
  16. <option value="Sally West|zaqxswde|logintop|">Sally West
  17. </select></td>
  18. <td align=right>User:</td><td><input type=hidden value="0" name=entry>
  19. <input type=text name=memname size=8 value=""></td></tr>
  20. <tr><td align=right>Password:</td><td><input type=text name=password size=8 maxlength=8><font size="-1"><-- Must be exactly 8 characters</font></td></tr>
  21. <tr><td align=right>Page Name:</td><td><input type=text name=pagename size=8 maxlength=8><b>.html</b><font size="-1"><-- Must be exactly 8 characters</font></td></tr>
  22. <tr><td colspan=2 align=center>
  23. <input type=button value="New User" onclick="addnew(this.form);">
  24. <input type=button value="Delete User" onclick="delthis(this.form);">
  25. <input type=button value="Update/Show Coding" onclick="update(this.form); create(this.form);"></td></tr>
  26. <tr><td colspan=3 align=center>
  27. <input type=text size=60 name=message value="Note: Password/Page Name must be exactly 8 letters! (a-z)">
  28. <input type=hidden name=num value=1></td>
  29. </form></tr>
  30. </table>
  31. <hr size=2 width=75%>
  32. <form name=js><textarea cols=75 rows=10 name=scrpt wrap=virtual>
  33. <SCRIPT LANGUAGE="JavaScript">
  34. <!-- Begin
  35. var params=new Array(4);
  36. var alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI";
  37. function check(form) {
  38. which=form.memlist.selectedIndex;
  39. choice = form.memlist.options[which].value+"|";
  40. if (choice=="x|") {
  41. alert("Please Select Your Name From The List");
  42. return;
  43. }
  44. p=0;
  45. for (i=0;i<3;i++) {
  46. a=choice.indexOf("|",p);
  47. params[i]=choice.substring(a,p);
  48. p=a+1;
  49. }
  50. h1=makehash(form.pass.value,3);
  51. h2=makehash(form.pass.value,10)+" ";
  52. if (h1!=params[1]) {
  53. alert("Incorrect Password!"); return; };
  54. var page="";
  55. for (var i=0;i<8;i++) {
  56. letter=params[2].substring(i,i+1)
  57. ul=letter.toUpperCase();
  58. a=alpha.indexOf(ul,0);
  59. a-=(h2.substring(i,i+1)*1);
  60. if (a<0) a+=26;
  61. page+=alpha.substring(a,a+1); };
  62. top.location=page.toLowerCase()+".html";
  63. }
  64. function makehash(pw,mult) {
  65. pass=pw.toUpperCase();
  66. hash=0;
  67. for (i=0;i<8;i++) {
  68. letter=pass.substring(i,i+1);
  69. c=alpha.indexOf(letter,0)+1;
  70. hash=hash*mult+c;
  71. }
  72. return(hash);
  73. }
  74. // End -->
  75. </script>
  76. </textarea>
  77. </form>
  78. <SCRIPT LANGUAGE="JavaScript">
  79. <!-- Begin
  80. var params=new Array(4);
  81. var script=document.js.scrpt.value;
  82. document.js.scrpt.value="Create your users, their passwords, and their destination pages using the form above.\n\nThen, click 'Show Coding' to see the login HTML and JavaScript that you need to put on your page to password-protect your site with that info.\n\nQuestions about this script or how to put it on your site should be directed to it's author via email: dion@mailhub.omen.com.au\n\n*Honestly, we don't even totally understand this JavaScript!*";
  83. var alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI";
  84. showmem(document.members);
  85. function showmem(form) {
  86. document.members.num.value=document.members.memlist.length;
  87. var which=form.memlist.selectedIndex;
  88. splt(form.memlist[which].value);
  89. form.entry.value=which+1;
  90. for (i=2;i<5;i++) {
  91. form.elements[i].value=params[i-2]; };
  92. }
  93. function splt(choice) {
  94. p=0;
  95. for (i=0;i<3;i++) {
  96. a=choice.indexOf("|",p);
  97. params[i]=choice.substring(a,p);
  98. p=a+1;
  99.   }
  100. }
  101. function addnew(form) {
  102. newmem=getfields(form);
  103. var who=prompt("New User's Name:","");
  104. form.memlist[form.memlist.length] = new Option(who, newmem, false, true);
  105. if (navigator.appName=="Netscape") {
  106. document.js.scrpt.value=script;
  107. history.go(0);
  108. }
  109. else {
  110. showmem(document.members);
  111.   }
  112. }
  113. function getfields(form) {
  114. newmem="";
  115. for (i=2;i<5;i++) {
  116. newmem+=form.elements[i].value+"|"; };
  117. for (i=3;i<5;i++) {
  118. a=form.elements[i];
  119. for (k=0;k<8;k++) {
  120.   }
  121. }
  122. return(newmem);
  123. }
  124. function delthis(form) {
  125. if (confirm("Delete "+form.memname.value+"?")) {
  126. form.memlist.options[form.entry.value-1]=null;
  127. form.message.value=form.memname.value+" Deleted";
  128. form.memlist.selectedIndex=0;
  129. if (navigator.appName=="Netscape") {
  130. document.js.scrpt.value=script;
  131. history.go(0);
  132. }
  133. else {
  134. showmem(document.members);
  135.    }
  136.   }
  137. }
  138. function update(form) {
  139. msg="no";
  140. a=form.elements[i];
  141. for (k=0;k<8;k++) {
  142. b=a.value.substring(k,k+1);
  143. c=b.toUpperCase();
  144. form.memlist[form.entry.value-1].value=getfields(form);
  145. form.message.value=form.memname.value+"'s record was updated";
  146.   }
  147. }
  148. function create(form) {
  149. var html="<center><form name=login>\n";
  150. html+="<table border=1 cellpadding=3>\n\n";
  151. html+="<!-- Original: Dion -->\n";
  152. html+="<!-- Web Site: http://www.iinet.net.au/~biab/ -->\n";
  153. html+="<!-- This script and many more are available free online at -->\n";
  154. html+="<!-- The JavaScript Source!! http://javascript.internet.com -->\n\n";
  155. html+='<tr><td colspan=2 align=center><font size="+2">';
  156. html+='<b>Members-Only Area!</b></font></td></tr>\n';
  157. html+="<tr><td>Username:</td><td><select name=memlist>\n<option value='x'>";
  158. for (j=0;j<form.memlist.length;j++) {
  159. splt(form.memlist.options[j].value);
  160. h1=makehash(params[1],3);
  161. h2=makehash(params[1],10)+" ";
  162. var page="";
  163. for (var i=0;i<8;i++) {
  164. letter=params[2].substring(i,i+1);
  165. ul=letter.toUpperCase();
  166. a=alpha.indexOf(ul,0);
  167. a+=(h2.substring(i,i+1)*1);
  168. page+=alpha.substring(a,a+1);
  169. }
  170. html+="\n<option value='"+params[0]+"|"+h1+"|"+page+"'>"+params[0];
  171. };
  172. html+="\n</select></td></tr>\n";
  173. html+="<tr><td>Password:</td><td><input type=password size=10 maxlength=8 name=pass></td></tr>\n";
  174. html+='<tr><td colspan=2 align=center><input type=button value="Login" onclick="check(this.form)"></td>\n';
  175. html+="</tr>\n</table>\n</form>\n";
  176. document.js.scrpt.value=html+script+"</center>";
  177. }
  178. function makehash(pw,mult) {
  179. pass=pw.toUpperCase();
  180. hash=0;
  181. for (i=0;i<8;i++) {
  182. letter=pass.substring(i,i+1);
  183. c=alpha.indexOf(letter,0)+1;
  184. hash=hash*mult+c;
  185. }
  186. return(hash);
  187. }
  188. // End -->
  189. </script>
  190. </center>
  191. <p><center>
  192. <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
  193. by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
  194. </center><p>
  195. <!-- Script Size: 6.50 KB -->



There are many more listed here: http://javascript.internet.com/passwords/

As it says on that page, keep this in mind:

These scripts all deal with JavaScript Password Protection scripts. They are an elementary attempt to protect a site and should NOT be used to protect Top Secret information. They just keep the amateurs out. Pros can infiltrate such sites with these forms of protection. But, for free, they do a good job.

Any kind of JavaScript protection can be broken or hacked, the best way to protect your pages would be to configure your server for password protection. With Apache Web servers you can usually do this using the .htaccess file to set certain directories so that they need a password.
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

if you have a pay account use an .htaccess and .htpassword file, seach google for .htaccess tutorials, then just plop it in the directory you wish to protect.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9091
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Or visit this post to learn more about password protecting your website with the .htaccess file:

http://www.ozzu.com/viewtopic.php?p=4229
  • MediaDesign
  • Loser
  • Loser
  • User avatar
  • Posts: 129
  • Loc: somewhere

Post 3+ Months Ago

what do you mea by protecting your web site

do you wanna protected area
or protect a file or a repertory ?


with asp php perl ?
java
  • andy007
  • Born
  • Born
  • andy007
  • Posts: 2
  • Loc: China

Post 3+ Months Ago

What kind of servers do you have ? web? ftp?? mail? or samba?
You don't need a script. Just use the service configuration.
  • jlbrennan20
  • Born
  • Born
  • jlbrennan20
  • Posts: 2

Post 3+ Months Ago

do u guys now any free webhost that allows use of .htaccess?
  • centix
  • Newbie
  • Newbie
  • centix
  • Posts: 5

Post 3+ Months Ago

andy007 wrote:
What kind of servers do you have ? web? ftp?? mail? or samba?
You don't need a script. Just use the service configuration.


what do you mean by 'service configuration'?
  • mikeruss
  • Born
  • Born
  • mikeruss
  • Posts: 2

Post 3+ Months Ago

Try this?

http://www.mikeruss.dircon.co.uk/htaccess/
  • tgurl
  • Born
  • Born
  • tgurl
  • Posts: 1

Post 3+ Months Ago

I am also trying to protect a website and have been trying to use the .htacces file to do this. It is not working so I must be doing something wrong. I made the files, check to make sure everything is in order, 'plopped' them in the directory. The I open the directory in a web browser and nada. How does the html file read the .haccess code? I am still at a loss as to how this is suppose to happen so if anyone understands how this work i would appreciate your help.

tgurl

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: Liamw411 and 127 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.