var with multiple possible values? (javascript newbie here)
I have been trying to get a beginner's grasp of javascript, with no previous programming experience. Please excuse me if this question is just toooo dumb, but I have tried all day to find answers elsewhere.
PLEASE don't tell me about whole different ways of doing this (mySQL, php etc). For all kinds of reasons, this is the method I am stuck with.
I have a form in which people enter a user name and password.
The form is on a page which calls a .js file, and which contains valid username and password info.
IF the user types a username and password corresponding with the values in the .js file, then a cookie is written and they are able to view subsequent pages. If not, they are redirected to an error page.
It all works fine if there is just one option for username and password. However I need to allow for six possible usernames and passwords. Have tried all sorts of things, but I just don't have the chops to get this to work.
Can anyone help? I feel like this SHOULD be so easy! It's driving me nuts.
A sample of the code is here:
http://www.gosh.net.nz/workingwise/goshnetsample.js
PLEASE don't tell me about whole different ways of doing this (mySQL, php etc). For all kinds of reasons, this is the method I am stuck with.
I have a form in which people enter a user name and password.
The form is on a page which calls a .js file, and which contains valid username and password info.
IF the user types a username and password corresponding with the values in the .js file, then a cookie is written and they are able to view subsequent pages. If not, they are redirected to an error page.
It all works fine if there is just one option for username and password. However I need to allow for six possible usernames and passwords. Have tried all sorts of things, but I just don't have the chops to get this to work.
Can anyone help? I feel like this SHOULD be so easy! It's driving me nuts.
A sample of the code is here:
http://www.gosh.net.nz/workingwise/goshnetsample.js
Peter Hall
August 31,