iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-24-2004, 11:40 AM
WebProWorld Member
 
Join Date: May 2004
Posts: 93
jmdb71 RepRank 0
Default modifying simple javascript

Hi,
I would like to add a few more ids and passwords to the following code. What would be the most efficient way of doing so? Thanks!

/*This Script allows people to enter by using a form that asks for a
UserID and Password*/
function pasuser(form) {
if (form.id.value=="Jon") {
if (form.pass.value=="Dapron") {
location="members/index.asp"
} else {
alert("Invalid Password")
}
} else { alert("Invalid UserID")
}
}
Reply With Quote
  #2 (permalink)  
Old 08-24-2004, 11:55 AM
esiegel's Avatar
WebProWorld Pro
 
Join Date: Jul 2003
Location: New York
Posts: 109
esiegel RepRank 0
Default Re: modifying simple javascript

Quote:
Originally Posted by jmdb71
Hi,
/*This Script allows people to enter by using a form that asks for a
UserID and Password*/
function pasuser(form) {
if (form.id.value=="Jon") {
if (form.pass.value=="Dapron") {
location="members/index.asp"
} else {
alert("Invalid Password")
}
} else { alert("Invalid UserID")
}
}
it looks like you are hard coding the username and password (Jon / Dapron) into the script.
I'm not a big fan of this method...since it makes it difficult to change, or to add users/passwords.

I would build it so that the usernames and passwords are stored in a database...and the login is verified by checking the database.

Not sure what tools you are using to build the page...but Dreamweaver has good components for applying this type of login to a page.

Your other option would be:
if (form.id.value=="Jon" || form.id.value=="Sue" ) {
__________________
Ed Siegel - Business Information Manager
Ampacet Corporation
http://www.Ampacet.com
Reply With Quote
  #3 (permalink)  
Old 08-24-2004, 12:13 PM
WebProWorld Member
 
Join Date: May 2004
Posts: 93
jmdb71 RepRank 0
Default thanks, question

Thanks for the reply! I have access to a MySQL database and my files are all active on a Windows server hosted by ipowerweb. I can not set the permissions, so using php scripts, I could not turn off all of the gibberish code that was displayed at the top of the screen during the login process. Any script suggestions? Thanks in advance.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:13 PM.



Search Engine Optimization by vBSEO 3.3.0