Closed Thread Icon

Topic awaiting preservation: JS Password protectin.. (Page 1 of 1) Pages that link to <a href="" title="Pages that link to Topic awaiting preservation: JS Password protectin.. (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: JS Password protectin.. <span class="small">(Page 1 of 1)</span>\

Bipolar (III) Inmate

From: #
Insane since: May 2002

posted posted 10-17-2003 11:57


Wondering if any of the JS gurus could give me a hand on this? I have googled till my browsers are sore but can find what I am looking for...

I need a very simple password protect script, no need to be secure, for a friends site that will host about 150 excel documents, he asked me if there was anyway to add a simple login/password script so all 150 members can access their own excel document.

I immediately thought of one of those "password is the file name password protection" scripts as below. Now this would be fine, not much work for me, (untechnical) mate uploads and administers the excel files, renames the file to what ever he wants and sends the members the password... all simple...

The problem with this script is that if the user gets the password wrong they get a 404 - is there anyway of modifying the script so that a bad password returns to a "password incorrect page" ??? I am guessing not but want to avoid using an applet like this one

Has anyone got any suggestions please .i.e should i be using ASP or PERL?



<script language="JavaScript">

function PasswordLogin()
document.location.href = document.formlogin.password.value + ".xls";
return false;

function CheckEnter(event)
var NS4 = (document.layers) ? true : false;
var code = 0;

if (NS4)
code = event.which;
code = event.keyCode;
if (code==13)
event.returnValue = false;




<form name="formlogin" onsubmit="PasswordLogin()">
Password: <input type="password" name="password" size="20" onKeyPress="CheckEnter(event)">
<input type="button" value="Login" onclick="PasswordLogin()"></p>



[This message has been edited by FatRod (edited 10-17-2003).]

Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-17-2003 12:22

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Bipolar (III) Inmate

From: #
Insane since: May 2002

posted posted 10-17-2003 12:34

If security was an issue i would not use JS and would go for .htaccess, but a password/ directing script is so simple and does exactly what is required, the xls files will only contains player stats and fixtures.

The password is not contained in any source and is the actual file name, i.e. filename is "pants.xls" password is pants, so it offers a small amout of protection. It does not matter if the person that logs in adds the page to favorites so it seems like a perfectly simple solution.


« BackwardsOnwards »

Show Forum Drop Down Menu