/// <summary>
 /// 重置玩家安全码信息
 /// </summary>
 /// <param name="serverIP">服务器IP</param>
 /// <param name="account">玩家帐号</param>
 /// <returns></returns>
 public static int UserSecureCodeInfo_Clear(int userByID, string userID)
 {
     try
     {
         XmlDocument         xmlfile   = new XmlDocument();
         string              md5string = MD5EncryptAPI.MDString(userID + "HAOHAOXUEXI");
         string              serverIP  = null;
         System.Data.DataSet ds        = SqlHelper.ExecuteDataset("select ServerIP from gmtools_serverInfo where gameid=999");
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             serverIP = ds.Tables[0].Rows[0].ItemArray[0].ToString();
             string         url     = "http://" + serverIP + "/gmtools?req=resetSecureCode&type=0&userid=" + userID + "&s=" + md5string;
             HttpWebRequest request = (HttpWebRequest)
                                      WebRequest.Create(url);
             request.KeepAlive = false;
             WebResponse  resp = request.GetResponse();
             StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
             xmlfile.Load(sr);
             XmlNode state = xmlfile.SelectSingleNode("you9/state");
             sr.Close();
             if (Convert.ToInt32(state.InnerText.ToString()) == 0)
             {
                 return(1);
             }
         }
         return(0);
     }
     catch (System.Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(0);
     }
 }
        /// <summary>
        /// 修改用户令牌,锁定-解锁-停用
        /// </summary>
        /// <param name="provide">服务提供商</param>
        /// <param name="service">请求服务名称</param>
        /// <param name="userName">用户名</param>
        /// <param name="esn">令牌号码</param>
        /// <returns>XML数据集</returns>
        public static ArrayList Modify_User_Token(string provide, string service, string userName, string esn)
        {
            string certificate = MD5EncryptAPI.MDString(service + "e10adc3949");
            string Xml         = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
                                 "<you9>" +
                                 "<request>" +
                                 "<provide>" + provide + "</provide>" +
                                 "<service>" + service + "</service>" +
                                 "<certificate>" + certificate + "</certificate>" +
                                 "<parameter>" +
                                 "<key>userName</key>" +
                                 "<value>" + userName + "</value>" +
                                 "</parameter>" +
                                 "<parameter>" +
                                 "<key>esn</key>" +
                                 "<value>" + esn + "</value>" +
                                 "</parameter>" +
                                 "</request>" +
                                 "</you9>";
            string url = "http://61.152.148.130:8080/authentic/authServlet";

            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.ContentType = "text/xml";
                request.KeepAlive   = false;
                request.Method      = "POST";
                ASCIIEncoding encodedData = new ASCIIEncoding();
                byte[]        byteArray   = encodedData.GetBytes(Xml);
                request.ContentLength = byteArray.Length;
                Stream newStream = request.GetRequestStream();
                newStream.Write(byteArray, 0, byteArray.Length);
                newStream.Close();
                WebResponse
                             resp    = request.GetResponse();
                StreamReader sr      = new System.IO.StreamReader(resp.GetResponseStream());
                XmlDocument  xmlfile = new XmlDocument();
                xmlfile.Load(sr);
                XmlNode nodes = xmlfile.SelectSingleNode("you9/response");
                System.Collections.ArrayList rowList = new System.Collections.ArrayList();
                foreach (XmlNode xmlnodes in nodes.ChildNodes)
                {
                    System.Collections.ArrayList colList = new System.Collections.ArrayList();
                    foreach (XmlNode chilenodes in xmlnodes.ChildNodes)
                    {
                        colList.Add(chilenodes.InnerText);
                    }
                    rowList.Add(colList);
                }
                sr.Close();
                return(rowList);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
        /// <summary>
        /// 查询玩家的邮件
        /// </summary>
        /// <param name="serverIP"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public static string SDOEmail_Query(string account)
        {
            XmlDocument xmlfile = new XmlDocument();

            /*string email = null;
             * DataSet ds = null;
             * SqlParameter[] paramCode;
             * string sql = "select b.email from user a,userinfo b where a.username='******' and a.id=b.id";
             * try
             * {
             *
             *      paramCode = new SqlParameter[6]{
             *                                                                         new SqlParameter("@SDO_ServerIP",SqlDbType.VarChar,30),
             *                                                                         new SqlParameter("@SDO_DataBase",SqlDbType.VarChar,20),
             *                                                                         new SqlParameter("@SDO_UserName",SqlDbType.VarChar,20),
             *                                                                         new SqlParameter("@SDO_UserPwd",SqlDbType.VarChar,20),
             *                                                                         new SqlParameter("@SDO_Sql",SqlDbType.VarChar,100),
             *                                                                         new SqlParameter("@Err",SqlDbType.VarChar,20,ParameterDirection.Output.ToString())};
             *      paramCode[0].Value = "61.129.66.164";
             *      paramCode[1].Value = "member";
             *      paramCode[2].Value = "db_oper";
             *      paramCode[3].Value = "db_oper@9you";
             *      paramCode[4].Value = sql;
             *      paramCode[5].Direction = ParameterDirection.Output;
             *      ds = SqlHelper.ExecSPDataSet("master..SelectInfo", paramCode);
             *
             *      if (ds.Tables[0].Rows.Count > 0)
             *      {
             *              email = (string)ds.Tables[0].Rows[0].ItemArray[0];
             *      }
             * }
             * catch (SqlException ex)
             * {
             *      Console.WriteLine(ex.Message);
             * }
             * return email;*/
            string md5string = MD5EncryptAPI.MDString(account + "HAOHAOXUEXI");

            System.Data.DataSet ds = SqlHelper.ExecuteDataset("select ServerIP from gmtools_serverInfo where gameid=999");
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                string         serverIP = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                string         url      = "http://" + serverIP + "/gmtools?req=queryUser&type=0&userid=" + account + "&s=" + md5string;
                HttpWebRequest request  = (HttpWebRequest)
                                          WebRequest.Create(url);
                //request.ContentType="GB2312";
                request.KeepAlive = false;
                WebResponse  resp = request.GetResponse();
                StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
                xmlfile.Load(sr);
                XmlNode email = xmlfile.SelectSingleNode("you9/user/email");
                sr.Close();
                return(email.InnerText);
            }
            return(null);
        }
 public static int User_Token_Close(int userByID, string userID)
 {
     try
     {
         XmlDocument         xmlfile   = new XmlDocument();
         string              md5string = MD5EncryptAPI.MDString(userID + "QUXUEXIBA");
         string              serverIP  = null;
         System.Data.DataSet ds        = SqlHelper.ExecuteDataset("select ServerIP from gmtools_serverInfo where gameid=999");
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             serverIP = ds.Tables[0].Rows[0].ItemArray[0].ToString();
             string         url     = "http://" + serverIP + "/gmtools?req=doEsn&type=authLock&userid=" + userID + "&s=" + md5string;
             HttpWebRequest request = (HttpWebRequest)
                                      WebRequest.Create(url);
             request.KeepAlive = false;
             WebResponse  resp = request.GetResponse();
             StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
             xmlfile.Load(sr);
             XmlNode state = xmlfile.SelectSingleNode("you9/state");
             sr.Close();
             if (Convert.ToInt32(state.InnerText.ToString()) == 0)
             {
                 //记录日志
                 SqlParameter[] paramCode = new SqlParameter[3] {
                     new SqlParameter("@GM_UserID", SqlDbType.Int),
                     new SqlParameter("@Card_UserID", SqlDbType.VarChar, 20),
                     new SqlParameter("@result", SqlDbType.Int)
                 };
                 paramCode[0].Value = userByID;
                 paramCode[1].Value = userID;
                 paramCode[2].Value = Convert.ToInt32(state.InnerText.ToString());
                 SqlHelper.ExecSPCommand("Card_SecureCodeInfo_Clear", paramCode);
                 return(1);
             }
         }
         return(0);
     }
     catch (System.Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(0);
     }
 }
        /// <summary>
        /// 反馈玩家的密码
        /// </summary>
        /// <param name="serverIP"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public static int sendEmailPasswd(int userByID, string serverIP, string account, string email, string password)
        {
            string pwd    = null;
            int    result = -1;

            SqlParameter[] paramCode;
            try
            {
                pwd       = MD5EncryptAPI.MDString(password);
                paramCode = new SqlParameter[5] {
                    new SqlParameter("@GM_UserID", SqlDbType.Int),
                    new SqlParameter("@SDO_ServerIP", SqlDbType.VarChar, 30),
                    new SqlParameter("@SDO_UserID", SqlDbType.VarChar, 20),
                    new SqlParameter("@9YOU_PWD", SqlDbType.VarChar, 32),
                    new SqlParameter("@result", SqlDbType.Int)
                };
                paramCode[0].Value     = userByID;
                paramCode[1].Value     = serverIP;
                paramCode[2].Value     = account;
                paramCode[3].Value     = pwd;
                paramCode[4].Direction = ParameterDirection.ReturnValue;
                result = SqlHelper.ExecSPCommand("SDO_EmailPWD_Update", paramCode);
                if (result == 0)
                {
                    if (1 == sendMail("*****@*****.**", email, account + "玩家密码", password))
                    {
                        return(1);
                    }
                }
                else
                {
                    return(0);
                }
            }

            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(0);
            }
            return(0);
        }
        /// <summary>
        /// 查看用户密码历史记录
        /// </summary>
        /// <param name="serverIP"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public static ArrayList User_Token_Query(string type, string strValue, string beginDate, string endDate)
        {
            XmlDocument xmlfile   = new XmlDocument();
            string      md5string = MD5EncryptAPI.MDString(strValue + "QUXUEXIBA");

            try
            {
                System.Data.DataSet ds = SqlHelper.ExecuteDataset("select ServerIP from gmtools_serverInfo where gameid=999");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string         serverIP = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                    string         url      = "http://" + serverIP + "/gmtools?req=viewToken&type=" + type + "&start=" + beginDate + "&end=" + endDate + "&v=" + strValue + "&s=" + md5string + "";
                    HttpWebRequest request  = (HttpWebRequest)
                                              WebRequest.Create(url);
                    request.KeepAlive = false;
                    WebResponse  resp = request.GetResponse();
                    StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
                    xmlfile.Load(sr);
                    //int i=1;
                    XmlNodeList nodeList = xmlfile.SelectNodes("you9/password/history9you");
                    System.Collections.ArrayList rowList = new System.Collections.ArrayList();
                    foreach (XmlElement tmp1 in nodeList)
                    {
                        System.Collections.ArrayList colList = new System.Collections.ArrayList();
                        foreach (XmlElement tmp2 in tmp1.ChildNodes)
                        {
                            colList.Add(tmp2.InnerText);
                        }
                        rowList.Add(colList);
                    }
                    sr.Close();
                    return(rowList);
                }
            }
            catch (SqlException ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 查询玩家的邮件
        /// </summary>
        /// <param name="serverIP"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public static string SDOEmail_Query(string account)
        {
            XmlDocument xmlfile = new XmlDocument();

            string md5string = MD5EncryptAPI.MDString(account + "QUXUEXIBA");

            System.Data.DataSet ds = SqlHelper.ExecuteDataset("select ServerIP from gmtools_serverInfo where gameid=999");
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                string         serverIP = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                string         url      = "http://" + serverIP + "/user?req=getUserInfo&id=GMTOOLS&userid=" + account + "&usertype=0&type=userinfo&s=" + md5string;
                HttpWebRequest request  = (HttpWebRequest)
                                          WebRequest.Create(url);
                request.KeepAlive = false;
                WebResponse  resp = request.GetResponse();
                StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
                xmlfile.Load(sr);
                XmlNode email = xmlfile.SelectSingleNode("you9/userinfo/email");
                sr.Close();
                return(email.InnerText);
            }
            return(null);
        }
        /// <summary>
        /// GM修改雙倍狀態
        /// </summary>
        public static string  ChangeServerExp_Query(string serverIP, int iExp, int iMoney, int userByID, string serverName, int type)
        {
            int    handle     = -1;
            int    state      = -1;
            string get_Result = "";

            serverIP = CommonInfo.JW2_FindDBIP(serverIP, 5);
            string userPwd = MD5EncryptAPI.MDString(SqlHelper.jw2gwUserPwd);

            try
            {
                string[] serverList = serverName.Split('|');
                for (int i = 0; i < serverList.Length - 1; i++)
                {
                    string[] GSserverList = serverList[i].Split(',');
                    string   GSserverName = GSserverList[0].ToString();
                    string   GSserverIP   = GSserverList[1].ToString();
                    int      GSserverNo   = int.Parse(GSserverList[2].ToString());
                    int      port         = int.Parse(GSserverList[3].ToString());
                    string   city         = CommonInfo.serverIP_Query(serverIP);
                    handle = JW2_CreateDLL();
                    state  = JW2_ConnectGW(handle, serverIP, 58118);
                    if (state == 0)
                    {
                        state = JW2_LoginGW(state, handle, SqlHelper.jw2gwUser, userPwd, SqlHelper.jw2gwVersion);
                        if (state == 0)
                        {
                            state = JW2_ConnectGS(handle, GSserverIP, port);
                            if (state == 0)
                            {
                                state = JW2_LoginGS(state, handle, 7044699);
                                if (state == 0)
                                {
                                    if (type == 0)
                                    {
                                        get_Result += JW2_SetGPointTimes(state, handle, (byte)iMoney, city, GSserverName, userByID);
                                    }
                                    else if (type == 1)
                                    {
                                        get_Result = JW2_SetExpTimes(state, handle, (byte)iExp, city, GSserverName, userByID);
                                    }
                                    else if (type == 2)
                                    {
                                        get_Result += JW2_SetGPointTimes(state, handle, (byte)iMoney, city, GSserverName, userByID);
                                        get_Result += JW2_SetExpTimes(state, handle, (byte)iExp, city, GSserverName, userByID);
                                    }
                                }
                                else
                                {
                                    get_Result += "【" + city.ToString() + "】大区,登?GS服务器:【" + GSserverName.ToString() + "】,失敗\n";
                                }
                            }
                            else
                            {
                                get_Result += "【" + city.ToString() + "】大区,連接GS服务器:【" + GSserverName.ToString() + "】,失敗\n";
                            }
                        }
                        else
                        {
                            get_Result += "【" + city.ToString() + "】大区,登?,失敗\n";
                        }
                    }
                    else
                    {
                        get_Result += "【" + city.ToString() + "】大区,連接,失敗\n";
                    }
                }
            }
            catch (System.Exception ex)
            {
                get_Result += "数据库连接失败,请重新尝试!";
                Console.WriteLine("789" + ex.Message);
            }
            JW2_DestroyDLL(handle);
            return(get_Result);
        }
        /// <summary>
        /// 反馈玩家的密码
        /// </summary>
        /// <param name="serverIP"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public static int sendEmailPasswd(int userByID, string account, string email, string password)
        {
            XmlDocument xmlfile = new XmlDocument();
            string      pwd     = null;
            int         result  = -1;

            SqlParameter[] paramCode;            /*
                                                  * try
                                                  * {
                                                  * pwd = MD5EncryptAPI.MDString(password);
                                                  * paramCode = new SqlParameter[4]{
                                                  * new SqlParameter("@GM_UserID",SqlDbType.Int),
                                                  * new SqlParameter("@SDO_UserID",SqlDbType.VarChar,20),
                                                  *                                                new SqlParameter("@9YOU_PWD",SqlDbType.VarChar,32),
                                                  *                                            new SqlParameter("@result",SqlDbType.Int)};
                                                  * paramCode[0].Value = userByID;
                                                  * paramCode[1].Value = account;
                                                  * paramCode[2].Value = pwd;
                                                  * paramCode[3].Direction = ParameterDirection.ReturnValue;
                                                  * result = SqlHelper.ExecSPCommand("SDO_EmailPWD_Update", paramCode);
                                                  * if (result==0)
                                                  * {
                                                  * if(1==sendMail("*****@*****.**", email, account+"玩家密码", password))
                                                  * return 1;
                                                  * }
                                                  * else
                                                  * return 0;
                                                  * }*/
            try
            {
                pwd = MD5EncryptAPI.nextID(6);
                string md5string       = MD5EncryptAPI.MDString(account + "HAOHAOXUEXI");
                string serverIP        = "";
                System.Data.DataSet ds = SqlHelper.ExecuteDataset("select ServerIP from gmtools_serverInfo where gameid=999");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    serverIP = ds.Tables[0].Rows[0].ItemArray[0].ToString();
                    string         url     = "http://" + serverIP + "/gmtools?req=updatePassword&type=0&userid=" + account + "&newPassword="******"&s=" + md5string;
                    HttpWebRequest request = (HttpWebRequest)
                                             WebRequest.Create(url);
                    //request.Method="Post";
                    request.KeepAlive = false;
                    WebResponse  resp = request.GetResponse();
                    StreamReader sr   = new System.IO.StreamReader(resp.GetResponseStream());
                    xmlfile.Load(sr);
                    XmlNode state = xmlfile.SelectSingleNode("you9/state");
                    sr.Close();
                    if (Convert.ToInt32(state.InnerText.ToString()) == 0)
                    {
                        //判断发送EMAIL是否成功
                        if (1 == sendMail("*****@*****.**", email, account, pwd))
                        {
                            result = 1;
                        }
                        else
                        {
                            result = 0;
                        }
                        //记录日志
                        paramCode = new SqlParameter[4] {
                            new SqlParameter("@GM_UserID", SqlDbType.Int),
                            new SqlParameter("@SDO_UserID", SqlDbType.VarChar, 20),
                            new SqlParameter("@9YOU_PWD", SqlDbType.VarChar, 32),
                            new SqlParameter("@result", SqlDbType.Int)
                        };
                        paramCode[0].Value = userByID;
                        paramCode[1].Value = account;
                        paramCode[2].Value = pwd;
                        paramCode[3].Value = result;
                        SqlHelper.ExecSPCommand("SDO_EmailPWD_Update", paramCode);
                        return(result);
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(0);
            }
            return(0);
        }