Computing.Net > Forums > Web Development > Simple JavaScript Question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Simple JavaScript Question

Reply to Message Icon

Name: hawkins6423
Date: July 20, 2004 at 12:35:11 Pacific
OS: Microsoft Windows XP Prof
CPU/Ram: CPU: AMD Athlon 3200+ Bar
Comment:

I just purchased www.matt-hawk.com and im using it for file sharing with friends and stuff, so i made a login page from dynamic drive javascripts.
It makes it so users have to use, username: member and password : mhnet, and here is the script:

function authUser(form) {
if (form.Username.value=="member") {
if (form.Password.value=="mhnet") {
location="../index.htm"
} else {
location="UnAuthorized.htm"
}
} else {
location="UnAuthorized.htm"
}
}

I know C++ so im pretty used to programming and i was wondering if there was a way that I could add more than one account, maybe like this:

function authUser(form) {
if (form.Username.value=="member") {
if (form.Password.value=="mhnet") {
location="../index.htm"
if (form.Username.value=="newuser") {
if (form.Password.value=="password") {
location="../index.htm"
} else {
location="UnAuthorized.htm"
}
} else {
location="UnAuthorized.htm"
}
}

Would that work?

thanks,
matt



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: July 20, 2004 at 12:53:05 Pacific
Reply:

Using javascript will keep out only the people that you don't need to worry about, those too inexperienced to cause any problems and those not inclined to cause you problems.

The reason is that you can't stop someone from seeing your JavaScript code. You can make it a little bit difficult, but that will just give some people more reason to try to get in.

If you can program in C++, you can figure out a server side way to handle the passwords.

The easiest way would probably be to use PHP. You can probably find PHP examples of how to do this.

You can also use C++ to do CGI programming but that will take more learning.


0

Response Number 2
Name: Don Arnett
Date: July 20, 2004 at 12:56:33 Pacific
Reply:

On your About Us page you talk about Matt Hawk Net, but your URL is matt-hawk.com.

I'd suggest going to godaddy.com or some similar cheap domain name registrar and getting matt-hawk.net. It's available. You can get it at godaddy.com for $8.95/year.

Just my 2cents.


0

Response Number 3
Name: hawkins6423
Date: July 20, 2004 at 13:46:33 Pacific
Reply:

do you know where a good place is for user authinication for websites in PHP are?
thanks for your help,
matt


0

Response Number 4
Name: Don Arnett
Date: July 20, 2004 at 14:28:47 Pacific
Reply:

Try google.com

Using "PHP login scripts" returned 2,600,000 hits


0

Response Number 5
Name: -Bryan-
Date: July 20, 2004 at 15:57:43 Pacific
Reply:

Yeah, definitely go with PHP. It was blatantly easy to discover the username and password, which were both also plain text. :(


0

Related Posts

See More



Response Number 6
Name: b0red
Date: July 21, 2004 at 10:37:09 Pacific
Reply:

Or you could use this in your javascript:

location.href=form.Password.value

Just rename a page to the password, be sure to turn off directory listing, and don't allow search engines to index it (meta tags).


0

Response Number 7
Name: Don Arnett
Date: July 21, 2004 at 20:25:13 Pacific
Reply:

bored

Good suggestion. I'd forgot about that option. I've never used it, but it's the only client side option I've seen that has any sort of security.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Simple JavaScript Question

Javascript Question www.computing.net/answers/webdevel/javascript-question/1119.html

Javascript Question www.computing.net/answers/webdevel/javascript-question/1564.html

Simple PHP Question www.computing.net/answers/webdevel/simple-php-question/2630.html