I have built a simple login system. I am using a php file to communicate with the database. The scenario I need is to do the login and if login is successful then load the mission. I am being able to login without a problem but for some reason unityscript is not evaluating/passing a simple condition. I have been trying to figure it out since two days. This is my snippet:
function login(w : WWW) {
yield w;
if (w.error == null) {
SendMessage("User", user);
if (w.text === "Logged in.") {
Debug.Log("Login Successful");
Application.LoadLevel("PrincipalScene");
} else {
message += w.text;
Debug.Log(w.text);
}
} else {
message += "Error: " + w.error + "
";
}
}
The problem is in the condition if (w.text === "Logged in.")
. It is not passing for some reason. My php snippet is like this:
if ($count == 0) {
echo ("User does not exist.
");
} else if (($count == 1) && ($pass == $row[‘password’])) {
echo(“Logged in.”);
} else {
echo("Password does not match.
");
}
I would be grateful if anyone could help in this.