Advertisement
Guest User

Untitled

a guest
Oct 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using System.Net;
  6.  
  7. public class Login : MonoBehaviour {
  8.  
  9.  
  10.  
  11. public Text usernameinput;
  12. public Text passwordinput;
  13. public static Login instance;
  14. //User stats
  15. public static string username;
  16. private void Awake()
  17. {
  18. instance = this;
  19. }
  20.  
  21.  
  22. public void signin()
  23. {
  24. username = usernameinput.text.ToString();
  25. string password = passwordinput.text.ToString();
  26. WebClient wc = new WebClient();
  27. string loginresult = wc.DownloadString("http://localhost/game.php?action=login&username=" + username + "&password=" + password);
  28.  
  29.  
  30.  
  31.  
  32. if (loginresult.Contains("1"))
  33. {
  34. Debug.Log(username);
  35. Application.LoadLevel(1);
  36. }
  37. else
  38. {
  39. Debug.Log("Wrong username or password");
  40. Debug.Log(username);
  41. Debug.Log(password);
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement