View Full Version : Encrypted Password Script problem

11-18-2005, 04:51 PM
Referring to: http://www.dynamicdrive.com/dynamicindex9/password.htm

I'm quite a newbie at all this. At any rate, I built a site for my local camera club and am using this script to protect member information. It worked fine when I first put the site up, but now (a month later), is no longer working. I don't believe I've changed anything, I've hardly touched the site until today, trying to figure out the problem. Any help would be appreciated. I really like this script when it works!

Page I'm referring to: http://www.hollistercameraclub.com/passwordpage.htm



11-18-2005, 05:38 PM
Your problem is this:

<script type="text/javascript">
@import url("password.js");
This is Javascript, not CSS.
You want:

<script type="text/javascript" src="password.js"></script>

11-18-2005, 05:42 PM
I've tried it both ways. No difference. I changed the JS source reference today but it was working and then quit working with the usual method. The problem is elsewhere.

And I've used this Javascript source reference on another site without problems.


11-18-2005, 05:44 PM
Would you mind using the other method, for debugging purposes?
And could you direct me to the other site where you've used this without problems?

11-19-2005, 12:07 AM
Well, I used the JS debugger tool in Opera and now the password script works in Firefox and Opera, but not in IE. Ugh! (And yes, Opera liked the regular JS script reference.)

The other page where I've used the @import method is:
http://www.ifwisheswerehorses.org/newversion.htm. Granted, this is a test page for a new layout and the page does have some issues, but as far as I can tell, they're not JS-related. The script is for the subscribe option and so far seems to work across Opera, Firefox and IE. (The recommend script is PHP-based and I'm having fits, but that's a different story.)

The way I made the password JS work in Opera and Firefox was to remove the "password" in this bit of the code:
alert("Sorry! This isn't correct!")}
originally: {window.location=password+"theproctectedpage.htm....}

But what's holding it up in IE? It was working perfectly there a month ago! Thanks for your time and help.


11-19-2005, 10:24 AM
Firstly, all is not well on the other page where you've used this. Firefox, for one, throws an "illegal character" error and doesn't use the script.
I don't have IE available to test this, unfortunately. Could you post the error(s) you get with this browser?

11-19-2005, 03:48 PM
I'm using the latest version of Firefox (not in safemode) and have tested the e-mail script a number of times on all three browsers and it works fine on my computer. Haven't tested it yet from another computer.

At any rate, IE doesn't give any specific error message with the password script. I've looked for a way to force it to give me the errors but I don't know how to do that in IE. All it says is "error on page". It doesn't even run the script because when I enter a wrong password, I don't even get my little "wrong password" pop-up box. At this point, I can only assume it's an IE/script incompatbility thing, but what?

I also assume that if there's an problem in IE, there will be the same problem in Netscape since they seem to be simliar. Haven't tried it there yet since that's on a different computer. (Firefox and Opera both use the correct password and give the pop-up box when a wrong one is entered.)

Here's the Javascript I'm using for the password (with password info removed):
function submitentry(){
password = document.password1.password2.value.toLowerCase()
username = document.password1.username2.value.toLowerCase()
passcode = 1
usercode = 1
for(i = 0; i < password.length; i++) {
passcode *= password.charCodeAt(i);
for(x = 0; x < username.length; x++) {
usercode *= username.charCodeAt(x);
alert("Sorry! This isn't correct!")}

Any thoughts?