# °°° password problem °°°

**URL:** <https://forum.kirupa.com/t/password-problem/29938>\
**Category:** flash\
**Created:** [September 2, 2003, 7:25am UTC](https://forum.kirupa.com/t/password-problem/29938 "2003-09-02T07:25:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lampe](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lampe](https://forum.kirupa.com/u/lampe)\
**Post date:** [September 2, 2003, 7:25am UTC](https://forum.kirupa.com/t/password-problem/29938/1 "2003-09-02T07:25:15Z")

</div>

hey there,

I made [this](http://www.kirupa.com/developer/flash5/ifelse.htm) tutorial and everything works just fine. But is it possible to use more than one password or not? I tried this:

password = inputName;  
if (password == “kirupa”) {  
answer = “kirupa is ok!”;  
} else {  
answer = “Access denied!”;  
}  
if (password == “lampe”) {  
answer = “lampe is ok!”;  
} else {  
answer = “Access denied!”;  
}

but what happened was this: if i fill in “kirupa”, i get acces denied. If i fill in “lampe”, it works (i get “lampe is ok!”).  
Is it possible to use two or more passwords?

thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 7:42am UTC](https://forum.kirupa.com/t/password-problem/29938/2 "2003-09-02T07:42:16Z")

</div>

You need else if()

[AS]password = inputName;  
if (password == “kirupa”) {  
answer = “kirupa is ok!”;  
} else if (password == “lampe”){  
answer = “lampe is ok!”;  
} else {  
answer = “Access denied!”;  
}[/AS]

If password is kirupa, do this, else if password is lampe, do this, else access denied.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 7:52am UTC](https://forum.kirupa.com/t/password-problem/29938/3 "2003-09-02T07:52:16Z")

</div>

store your passwords in an array:

```auto
Array.prototype.doCheck = function ( psw )
{
for ( var i=0 ; i<this.length ; i++ ) if ( this* == psw ) return "Access Granted";
return "Access Denied";
}

mypsws = ["kirupa" , "lampe" , "ahmed"];

```

… now, to call the doCheck function, you would do this

```auto
answer = mypsws.doCheck("kirupa");
trace(answer);

```

let me know how that goes

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 8:35am UTC](https://forum.kirupa.com/t/password-problem/29938/4 "2003-09-02T08:35:50Z")

</div>

thank you sooo mutch, it works great!

lampe

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 2, 2003, 3:25pm UTC](https://forum.kirupa.com/t/password-problem/29938/5 "2003-09-02T15:25:19Z")

</div>

Nice one there Ahmed, you could also use a for…in loop instead of a standard for loop…

[AS]Array.prototype.doCheck = function(psw) {  
for (var i in this) if (this\* == psw) return “Access Granted”;  
return “Access Denied”;  
};[/AS]
