flash & xml Q - password
- Started
- Last post
- 8 Responses
- goygoygoy
with action script
what would be the faster way to check if a login match with login node and, then if it founds it, that the password matches with password node?
- JazX0
you don't necessarily need to use XML.
- goygoygoy0
no, I know that, but in that case, I have to... the problem is more in the way I construct my flash function to do the check...
- unfittoprint0
I don't think it's very wise to make passwords and logins check with XML/Flash. You should leave that to backend scripting php/mysql.
anyway, it's just a question of looping the diffrente nodes, something like:
content = contentXML.firstChild.ChildNodes
for(i=0; i{content.length, i++){
if(content[i].attributes.log == log){
if(content[i].pass == pass){
trace('correct login');
break;
}
}
}
- goygoygoy0
acutally, backend is done in asp, but I'll get an xml file with the results.
I'm using the same method as you, mmm maybe my 'break' was in a really wrong place, thks unfit.
- unfittoprint0
the normal method is to check the username/password against your users db table and output/echo a false/true statement to Flash.
- goygoygoy0
I guess, but I really have no idea about connecting with db. Do you think there is a real security problem working with an xml sheet?
- unfittoprint0
it's not just that. if you have to retrieve a whole table of users , let's say more than 1000, and send to Flash as a XML [wich will take already quite some time], and then use a for loop to check if it's the correct login, FLash will choke, and probably freeze the user's machine.
wiht only one statement in php will have your answer. soemthing like:
$query = "SELECT * FROM users WHERE username=$username"
$result = @mysql_query($query);if($result){
$user = @mysql_fetch_array($result);
if($user['password'] = md5($password){
echo"login=true";
} else {
echo"login="false";
}
} else {
echo "error connecting to db";
}
- goygoygoy0
thks a lot for your response (willing to help... as always).
I'll see that with the backend guy. but i'm not sure it will be necessary as we will have something like a maximum of 20 users...I'm getting very impatient to begin my db lessons wich starts tomorrow! hipaaa!
tks a lot