Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string userLoginFile = "http://localhost/UserLogin.php?";
- string username = "";
- string password = "";
- string email;
- public void LoginGUI()
- {
- GUI.skin = this.guiSkin;
- username = GUI.TextField (new Rect(Screen.width / 2 - 110, Screen.height / 2 - 20, 220, 30), username, GUI.skin.GetStyle("textfield"));
- password = GUI.PasswordField (new Rect(Screen.width / 2 - 110, Screen.height / 2 + 15, 220, 30), password, "*"[0], GUI.skin.GetStyle("textfield"));
- if(GUI.Button (new Rect(Screen.width / 2 - 110, Screen.height / 2 + 50, 220, 30), "Login", GUI.skin.GetStyle("button")))
- {
- StartCoroutine(LoginUser(username, password));
- }
- GUILayout.Label(email);
- }
- IEnumerator LoginUser(string user, string pass)
- {
- WWW login = new WWW(userLoginFile + "username=" + user + "&password=" + pass);
- yield return login;
- if(login.error == null)
- {
- string[] credentials = login.text.Split('/');
- foreach (string str in credentials)
- {
- string[] creds = str.Split('=');
- for(int i=0; i < creds.Length; i++)
- {
- if(creds[i] == "email")
- {
- email = creds[i + 1];
- this.currentGUIMethod = MainMenuGUI;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment