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();
&& 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);
well unfourtunately it makes sense, but flash is giving me an error message when i attempt ot put the or and if together?
I don’t think you need the second if:
if((user == "flash" && pass == "vista") or (user == "flash2"&& pass == "vista2")){
//this should work
}
hth
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
}
hey, thanks alot, i cant seem to figure out what i was doing, must of been that if thanks again,
tim
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