If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Since this is so popular and simple, yet people somehow still have problems getting it to work, I've also added a VBScript file you can run, which will prompt you for the username, password, and URL of the protected page.

It will then create the javascript password file for people unfamiliar with javascript. All you need to do then, is put the password file in the same directory as login.htm and auth.htm.

The URL is not validated, so if the resulting password file doesn't work, you probably typed the URL wrong.

The .zip file is attached to this message.

Just double click on the "PasswordHelper.vbs" VBScript file and follow the instructions to create your password file(s). You need to run this file locally, and then upload the password file(s) to your website.

cool!

very cool idea, the whole client side password protection thing-- personally ill stick with server side, but for using javascript thats amazing. the only other script ive see that would do that is one that encoded the passwords.

anyway, just a few things anyone who has that might want to try:

1. Try using cookies. Have it check the cookie, and if either the cookie doesnt exist, have it send them off some where in the internet, or have 1000000000000 windows pop up, or just send them to the bad password page.

when it sends you to whatever the user's script(ie, BenastanFool.js), have this at the beginning:

No... but it's not correct HTML. What he meant by "..." was put any other attributes there that need to go there, in place of "...".

If you look at the original example code, you'll see what I mean. It works - because it's coded correctly. Better yet, download the .zip file I provided that has the XHTML compatible code and the password helper.

<td>Password: </td><td><input type="text" name="pass" /></td>

all you need to do is change the input type to "password" instead of "text"

Frames?

my password log in is in the mainpage and when the ppl log in then i dont want the page.htm (the page the ppl come to when they log in correct) only be in the middle beacuse i want to change the Meny (1) and news (2).

My question is can I make the page.htm not framed. I mean so it will be the only page open!

not sure if anyone will respond. . .BUT. . .

was wondering if anyone knew why I can use this and easily link to any page so long as I use the http://www. . . format, but as soon as I try to link within my site I somehow can't. Why can I not redirect to /Homepage.html for example? This is how I use EVERY other link on my site. . .why is it not working here?

yeh i had the same problem when i was editing the code of the .js file. and me not being a JS person took a while to figure it out. i did eventually find out how to do it.
eg. say you have the login.htm in folder "welcome" and you want to redirect to a folder under "welcome" named "me". open your .js and it should say

when you enter the username and password, login.htm will goto the .js file and look at the { redirect = "me/******.htm"; } when you added the "me/" into the redirect, it will then goto the folder named "me" in the same 'level' and will then look for the page you want to goto.

NOTE: i think the login and .js file has to be in a higher level than the page you want to redirect to.

Script help

Wonder if anyone can help please.

I have very little experience of js,and web design in general,and desp for help.

Looking to create a secure login for a newletter site which will be online hopefully next week. It must be fairly secure for a number of reasons and with the option of user/password change at any time,although probably once a month. THe Whammy vb script was recommended,but I have tried everything to get it working without success.
Downloaded script,set user/password ok. and homepage url.

If I go into the login html file it DOES take me straight into my site,and to test if the wrong user/password is enetered into the login html it will not.

I have a site which will be coming down this weekend,and just trying to test the script on this,so I know what to do when newsletter is up.

Currently it uses index.html as the inital ftp load file. I have tried setting this to login html,tried all js as initial files,but still nothing.

As the login file does not link to my index file,could this be the problem.

I know I am missing something and its probably simple,but desp for some advise.

Well it really depends on your host, if you have access to server side languages, such as php, asp, perl, python, java etc you can do this more securely and with more conventional methods (also not to mention easier to change access lists) but if you don't this would be your alternative.