Advertisement
xxnorxx

register in c#

Nov 18th, 2017
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class DataInserter : MonoBehaviour
  7. {
  8.  
  9.     string CreateUserURL = "http://xxnorxx.alwaysdata.net/insertUser.php";
  10.  
  11.     public string inputUsername = "";
  12.     public string inputPassword = "";
  13.  
  14.  
  15.     public Canvas main;
  16.     public Canvas register;
  17.  
  18.     public InputField IFUsername;
  19.     public InputField IFPassword;
  20.  
  21.  
  22.     // Use this for initialization
  23.     void Start ()
  24.     {
  25.        
  26.     }
  27.    
  28.     // Update is called once per frame
  29.     void Update ()
  30.     {
  31.         if (regPress)
  32.         {
  33.             CreateUser(inputUsername, inputPassword);
  34.            
  35.             inputUsername = "";
  36.             inputPassword = "";
  37.  
  38.             main.enabled = true;
  39.             register.enabled = false;
  40.  
  41.             regPress = false;
  42.         }
  43.     }
  44.  
  45.     public void CreateUser(string username, string password)
  46.     {
  47.         WWWForm form = new WWWForm();
  48.         form.AddField("usernamePost", username);
  49.         form.AddField("passwordPost", password);
  50.  
  51.         WWW www = new WWW(CreateUserURL, form);
  52.     }
  53.  
  54.     bool regPress = false;
  55.  
  56.     public void btnReg()
  57.     {
  58.        
  59.  
  60.         if (IFUsername.text != "" && IFPassword.text != "" && IFUsername.text != "" && IFPassword.text != "")
  61.         {
  62.             inputUsername = IFUsername.text;
  63.             inputPassword = IFPassword.text;
  64.  
  65.             IFUsername.text = "";
  66.             IFPassword.text = "";
  67.             regPress = true;
  68.         }
  69.     }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement