/    Sign up×
Community /Pin to ProfileBookmark

To More Anti-Ignorant People… HELP!

Hi. I have this script, where I want it to use a multi-user login. the code is below.

[I]var username=window.prompt(‘Enter your Username’);
var password=window.prompt(‘Enter your Password’);

if (username=”Nick” && password=”a”){var login=”1″;} Else {var login=”0″;}
if (username=”Bob” && password=”b”){var login=”2″;} Else {var login=”0″;}
if (username=”Joe” && password=”c”){var login=”3″;} Else {var login=”0″;}

switch (login){
case “1”:
window.alert(‘Welcome, Nick’);
window.location(‘http://www.google.com/‘);
case “2”:
window.alert(‘Welcome, Bob’);
window.location(‘http://www.google.com/‘);
case “3”:
window.alert(‘Welcome, Joe’);
window.location(‘http://www.google.com/‘);
case “4”:
window.alert(‘Who are you?!? Begone with you!’);
window.location(‘http://www.google.com/‘);
}[/I]

I have 2 problems. One is that mainly, it doesn’t work! If someone could help me out, I’d appreciate it. And Two, is there someway you can block an external script from being viewed in a browser, or someway to keep people from reading the Usernames and Passwords? Thanks.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Jeff_MottFeb 03.2010 — Here is a demonstration showing how it can be done.

http://www.webdeveloper.com/forum/showpost.php?p=925641&postcount=1

But you'll need to expand on the principle to make it a multi-user system.
×

Success!

Help @Nifrpe spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...