Beispiel #1
0
    IEnumerator SendUpdateIP()
    {
        string hashString = HashingData.Md5Sum(PlayerName + SecretKey).ToLower();

        WWWForm wwwForm = new WWWForm();

        wwwForm.AddField("name", PlayerName);
        wwwForm.AddField("IP", IP);
        wwwForm.AddField("score", Score);
        wwwForm.AddField("type", "2");         // This will be to check on the server if we are sending IP correctly
        wwwForm.AddField("hash", hashString);

        WWW www = new WWW(SaveInfoPhpURL, wwwForm);

        yield return(www);

        if (www.error != null)
        {
            Debug.LogWarning(www.error);
        }
        else
        {
            Debug.Log(www.text == "successipdb" ? string.Format("Save the new IP {0} success!", IP) : www.text);
        }
    }
Beispiel #2
0
    IEnumerator RegisterRoutine()
    {
        if (isRegister)
        {
            yield return(null);
        }

        isRegister = true;

        LoginManager.UpdateDescription("Registering.....");
        LoginManager.LoadingCache.ChangeText("Request Register", true);

        string hash = HashingData.Md5Sum(UserName + Email + Password + SecretKey).ToLower();

        WWWForm Form = new WWWForm();

        Form.AddField("name", UserName);
        Form.AddField("password", Password);
        Form.AddField("email", Email);
        Form.AddField("score", 0);
        Form.AddField("IP", LoginManager.IP);
        Form.AddField("hash", hash);

        WWW www = new WWW(RegisterPhpUrl, Form);

        LoginManager.UpdateDescription("Uploading your info to the DB. Stay still!");

        yield return(www);

        LoginManager.LoadingCache.ChangeText("Getting the response from DB.....", true, 3f);

        if (www.text == "Done")         // gonna check this for the server side programming
        {
            LoginManager.UpdateDescription("Registered succesfully, good job." + "You can Login now.");
            this.GetComponent <LoginManager>().ShowLogin();
        }
        else
        {
            LoginManager.UpdateDescription(www.text);
        }

        isRegister = false;
    }
Beispiel #3
0
    public void RegisterUser()
    {
        string hash = HashingData.Md5Sum(UserName + Email + Password + Re_Password);

        if (isRegister)         // if user has already registered
        {
            return;
        }

        if (UserName != string.Empty && Email != String.Empty && Password != String.Empty && Re_Password != String.Empty)
        {
            if (Password == Re_Password)
            {
                StartCoroutine(RegisterRoutine());
                LoginManager.UpdateDescription("");
            }
            else
            {
                LoginManager.UpdateDescription("Passwords does not match");
            }
        }
        else
        {
            if (UserName == String.Empty)
            {
                LoginManager.UpdateDescription("Username is empty");
            }
            if (Email == String.Empty)
            {
                LoginManager.UpdateDescription("Email is empty or you have entered an invalid email address");
            }
            if (Password == String.Empty)
            {
                LoginManager.UpdateDescription("Password is empty");
            }
            if (Re_Password == String.Empty)
            {
                LoginManager.UpdateDescription("Password is empty");
            }
            LoginManager.UpdateDescription("Complete all the fields above.");
        }
    }
Beispiel #4
0
    // end of comments

    IEnumerator Save(int s)
    {
        string hash = HashingData.Md5Sum(PlayerName + SecretKey).ToLower();

        int score = s;

        WWWForm Form = new WWWForm();

        Form.AddField("name", PlayerName);
        Form.AddField("score", Score);
        Form.AddField("hash", hash);
        Form.AddField("type", "1");         //  This will be to check on the server if we are saving the info for the player

        WWW www = new WWW(SaveInfoPhpURL, Form);

        yield return(www);

        if (www.error == null)
        {
            Score = score;
        }
        Debug.Log("info saved, great!!");
    }