Beispiel #1
0
        private void BeginCHeckPassword()
        {
            if (CheckPassword())
            {
                string _insertSql = $"INSERT INTO {table} (Name, Comment,URL, UpdateTime, Title,Progress) " +
                                    "VALUE( @Name " +
                                    ", @Comment " +
                                    ", @URL " +
                                    ", now() " +
                                    ", @Title " +
                                    ", @Progress );";

                string[] _parameters = new string[]
                {
                    "Name", _localData.TeamName,
                    "Comment", _localData.Comment,
                    "Progress", _localData.Progress.ToString(),
                    "Title", _localData.Title,
                    "URL", _localData.URL
                };
                MySQLUtil.DBInsert(_insertSql, _parameters);

                MakeUserPoint();
                MySQLUtil.DBClose();
            }
        }
Beispiel #2
0
        // 3+4+5+6+7 DBに接続してパスワードチェック
        private bool CheckPassword()
        {
            MySQLUtil.DBConnection();
            string selectSql = $"SELECT Password FROM  {database}.{userTable} WHERE Name=@Name ;";

            string[] parameters = new string[] { "Name", _localData.TeamName };

            DataTable tbl = MySQLUtil.DBSelect(selectSql, parameters);

            // 3.exist data?
            if (tbl.Rows.Count == 1)
            {
                // yes
                foreach (DataRow row in tbl.Rows)
                {
                    if (_localData.Password == row[0].ToString())
                    {
                        // 7.check ok
                        return(true);
                    }
                    else
                    {
                        // 5. local data delete
                        MySQLUtil.DBClose();
                        _localData.Password = "";
                        LocalDataExport();

                        EditorUtility.DisplayDialog("パスワードチェックエラー", "パスワードが合いません\r\n再入力をお願いします", "OK");
//                        Debug.Log("password error");
                        return(false);
                    }
                }
            }
            else
            {
                // no 6. db insert
                string insertSql = $"insert into {database}.{userTable} (Name ,Password) " +
                                   " value ( @Name , @Password );";
                parameters = new string[]
                {
                    "Name", _localData.TeamName,
                    "Password", _localData.Password
                };
                MySQLUtil.DBInsert(insertSql, parameters);
                return(true);
            }

            return(false);
        }