password

R

Roger Judd

Hello,

I need the JavaScript code for a low security password that I can put into
my homepage
so only club members can access certain pages of info.

Can anyone give me an example please
My e-mail address is (e-mail address removed)
Many thanks
Roger
 
D

David Dorward

Roger said:
I need the JavaScript code for a low security password that I can put into
my homepage so only club members can access certain pages of info.

There are two ways to do this in JavaScript.

* The really ineffective way:

Ask the user for a string.
Compare that string to one placed in the JavaScript.
Redirect if the strings match.

Major problem: The user can look at the source and go to the URI.

* The ineffective way:

Ask the user for a string.
Go to http://something.or.other + string + .html

Thus turning the whole password thing into a complicated way of saying:
"This URL here... its secret. Don't tell anyone, 'k?"

If you want password protection, you need a server side tool. Forget
JavaScript (unless you are one of those very rare people using server side
JavaScript [e.g. ASP+JScript]).
 
A

Andrey

Roger said:
Hello,

I need the JavaScript code for a low security password that I can put into
my homepage
so only club members can access certain pages of info.

Can anyone give me an example please
My e-mail address is (e-mail address removed)
Many thanks
Roger

Where are you going to store the password? If on the server, then you need a server side tool which
will check the entered password on the postback.

My advise - don't mess with Javascript for that - you CAN'T do any reliable protection if it's on
client's side - even if you "hide" the password in another .js file, client can anyway see it,
looking in the page source

WYGL
Andrey
 
P

PDannyD

Roger Judd said:
Hello,

I need the JavaScript code for a low security password that I can put
into my homepage
so only club members can access certain pages of info.

Without using any stored passwords or server-side scripts you will be
needing an encrypt/decrypt key.

First encrypt the text using some random key and give this key to your
members.
The encrypted text can then be cut-n-pasted into the live webpage.
If any visitor doesn't give the correct decryption key then all they see is
gibberish. The benefit is that you don't store the password or readable data
anywhere, it's all decrypted client-side.

There is a little javascript which will encrypt/decrypt text. It uses the
same key for both and isn't secure enough for something like online shopping
but it'll do what you need.

When I'm back at work on Monday I'll find the link and post it as a reply to
this message. I might even knock up a test page if I'm feeling kind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top