Skip to content

Instantly share code, notes, and snippets.

@CloudyWater
Created January 29, 2017 20:40
Show Gist options
  • Save CloudyWater/cba5707c85f630db08ea34269abffad4 to your computer and use it in GitHub Desktop.
Save CloudyWater/cba5707c85f630db08ea34269abffad4 to your computer and use it in GitHub Desktop.
Added the following code to DatabaseConnection.cs
private const string GET_USER_URL = "http://localhost/GetUser.php?";
public void LogInAccount (string username, string password)
{
StartCoroutine (PostLoginAccount (username, password));
}
IEnumerator PostLoginAccount (string username, string password)
{
string postUrl = GET_USER_URL + "username=" + WWW.EscapeURL (username);
WWW hsPost = new WWW (postUrl);
yield return hsPost;
if (hsPost.error != null)
{
Debug.Log ("Error: " + hsPost.error);
}
else
{
if (Crypto.Decrypt (hsPost.text).Equals (password))
{
Debug.Log ("Success! Correct password entered.");
}
else
{
Debug.Log ("Error! incorrect password entered.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment