コード例 #1
0
ファイル: player_info.cs プロジェクト: redphoenix2000/my_game
 public void apply()
 {
     try
     {
         ConnectBdd();
         bool            b            = false;
         GameObject      pseudo       = GameObject.FindGameObjectWithTag("player");
         MySqlCommand    command_info = new MySqlCommand("SELECT * FROM users WHERE pseudo = '" + @pseudo.name + "'", con);
         MySqlDataReader my_Reader    = command_info.ExecuteReader();
         while (my_Reader.Read())
         {
             if (DataBaseManag.crypt256(lastpass.text) == my_Reader.GetString(2) && new_pass.text == confirm_pass.text)
             {
                 b = true;
             }
             if (lastpass.text == "" || new_pass.text == "" || confirm_pass.text == "")
             {
                 b          = false;
                 error.text = "Error : " + "Select all input";
             }
             else
             {
                 error.text = "Error : " + "Maybe wrong late pass or pass different";
             }
         }
         my_Reader.Close();
         if (b)
         {
             string       command = "UPDATE users SET password= '******' WHERE pseudo='" + pseudo.name + "';";
             MySqlCommand cmd     = new MySqlCommand(command, con);
             try
             {
                 cmd.ExecuteReader();
                 Debug.Log("Update success");
             }
             catch (IOException ex)
             {
                 Debug.Log(ex);
             }
             cmd.Dispose();
             panel.gameObject.SetActive(false);
             pseudo.gameObject.SetActive(true);
             pass.gameObject.SetActive(true);
             email.gameObject.SetActive(true);
             grad.gameObject.SetActive(true);
             menu_button.gameObject.SetActive(true);
             update_button.gameObject.SetActive(true);
         }
         con.Close();
     }
     catch (IOException ex)
     {
         Debug.Log(ex);
     }
 }
コード例 #2
0
ファイル: player_info.cs プロジェクト: redphoenix2000/my_game
    public void ConnectBdd()
    {
        string constr = "Server=" + host + ";DATABASE=" + database + ";User ID=" + username + ";Password="******";Pooling=true;Charset=utf8;";

        try
        {
            con = new MySqlConnection(constr);
            con.Open();
        }
        catch (IOException ex)
        {
            Debug.Log(ex.ToString());
        }
    }