# Flash Login Script

**URL:** <https://forum.kirupa.com/t/flash-login-script/260422>\
**Category:** flash\
**Created:** [May 15, 2008, 1:57pm UTC](https://forum.kirupa.com/t/flash-login-script/260422 "2008-05-15T13:57:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tenpins77](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@tenpins77](https://forum.kirupa.com/u/tenpins77)\
**Post date:** [May 15, 2008, 1:57pm UTC](https://forum.kirupa.com/t/flash-login-script/260422/1 "2008-05-15T13:57:32Z")

</div>

Hey all, looking for any help i can get with this one, what im looking to do is be able to add more than one “user”, the script as is now, lets a user “log in”, unsecurly which lets them view another “flash” page, im really not that concerned with security locks, as this is more so for a false sense of security, and their looking for more than one user to login,heres my action script?  
Thanks for the help,

tim

function login(user, pass) {  
trace (user+" ",+pass)  
if (user == “flash”&& pass == “vista”) {  
//login ok, update the status textfield and proceed to the secured area  
status = "Welcome, "+user;  
gotoAndStop(2);  
} else {  
// login failed, you might want to output some error messages here.  
if (user != “flash”) {  
status = “Wrong username”;  
} else {  
status = “Wrong password”;  
}  
}  
}  
// Stop the movie here  
stop();

---

<div class="post-metadata">

**Author:** ![dunger99us](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@dunger99us](https://forum.kirupa.com/u/dunger99us)\
**Post date:** [May 15, 2008, 4:53pm UTC](https://forum.kirupa.com/t/flash-login-script/260422/2 "2008-05-15T16:53:14Z")

</div>

&& means “and” so you should add an operand which means “or”

like (the code below is not a code, just my idea of the concept)

if (user == “flash”&& pass == “vista”) or(if (user == “flash2”&& pass == “vista2”)  
status = "Welcome, "+user;  
gotoAndStop(2);

---

<div class="post-metadata">

**Author:** ![tenpins77](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@tenpins77](https://forum.kirupa.com/u/tenpins77)\
**Post date:** [May 16, 2008, 1:56pm UTC](https://forum.kirupa.com/t/flash-login-script/260422/3 "2008-05-16T13:56:02Z")

</div>

well unfourtunately it makes sense, but flash is giving me an error message when i attempt ot put the or and if together?

---

<div class="post-metadata">

**Author:** ![hasch2o](https://avatars.discourse-cdn.com/v4/letter/h/ba8739/32.png) [@hasch2o](https://forum.kirupa.com/u/hasch2o)\
**Post date:** [May 19, 2008, 12:26am UTC](https://forum.kirupa.com/t/flash-login-script/260422/4 "2008-05-19T00:26:37Z")

</div>

I don’t think you need the second if:

```auto

if((user == "flash" && pass == "vista") or (user == "flash2"&& pass == "vista2")){
   //this should work
} 

```

hth

---

<div class="post-metadata">

**Author:** ![Ikinsey](https://avatars.discourse-cdn.com/v4/letter/i/f14d63/32.png) [@Ikinsey](https://forum.kirupa.com/u/Ikinsey)\
**Post date:** [May 19, 2008, 5:10am UTC](https://forum.kirupa.com/t/flash-login-script/260422/5 "2008-05-19T05:10:56Z")

</div>

Use || not or.

Also, if you’re looking to make something which is extensible (ie: have more than two users), you should really have an array of users and passwords and just cross check (ie: userArray[“flash1”] = “vista1” userArray[“flash2”] = “vista2”). Then your check would be like this no matter how many users you add to the array:

if(userArray[user] == pass)  
{  
//login successful  
}

---

<div class="post-metadata">

**Author:** ![tenpins77](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@tenpins77](https://forum.kirupa.com/u/tenpins77)\
**Post date:** [May 20, 2008, 6:19pm UTC](https://forum.kirupa.com/t/flash-login-script/260422/6 "2008-05-20T18:19:44Z")

</div>

hey, thanks alot, i cant seem to figure out what i was doing, must of been that _if_ thanks again,

tim

---

<div class="post-metadata">

**Author:** ![tenpins77](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@tenpins77](https://forum.kirupa.com/u/tenpins77)\
**Post date:** [May 20, 2008, 6:41pm UTC](https://forum.kirupa.com/t/flash-login-script/260422/7 "2008-05-20T18:41:49Z")

</div>

also, i noticed that it will quickly show the secured page for less than a seccond then go to the login page? Could this just be a delay with the pc or would it be a flash error?

thanks,

tim
