Exemplo n.º 1
0
        public string getReward(string sGameName, int iUserID)
        {
            if (iUserID < 1000000)
            {
                return("useriderr!");
            }
            string sAccount = UserBll.AccountSel(iUserID);
            string sRes     = string.Empty;

            if (!NoRegGiftBLL.NoRegGiftUserIDSel(iUserID))
            {
                sRes = "1";
            }
            else
            {
                string sLevel  = NoRegGiftBLL.ULevelSel(iUserID, sGameName);
                string sTranIP = ProvideCommon.GetRealIP();
                int    iPoint  = 10;
                if (sLevel == "-2")
                {
                    string sGiftRes = NoRegGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP);
                    if (sGiftRes == "0")
                    {
                        NoRegGiftBLL.NoRegGiftAdd(iUserID, -2, sGameName);
                        sRes = "0";
                    }
                    else
                    {
                        sRes = sGiftRes;
                    }
                }
                else
                {
                    int iLevel = 0;
                    int.TryParse(sLevel, out iLevel);
                    if (iLevel > 14)
                    {
                        string sGiftRes = NoRegGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP);
                        if (sGiftRes == "0")
                        {
                            NoRegGiftBLL.NoRegGiftAdd(iUserID, iLevel, sGameName);
                            sRes = "0";
                        }
                        else
                        {
                            sRes = sGiftRes;
                        }
                    }
                    else
                    {
                        sRes = "2";
                    }
                }
            }
            return(sRes);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="passwordtwo">新密码</param>
        /// <param name="bpassword">原密码</param>
        /// <returns>0成功,1失败,2原始密码验证失败</returns>
        private string UpdatePass(int iUserID)
        {
            string passwordtwo = CYRequest.GetString("passwordtwo");
            string bpassword   = CYRequest.GetString("bpassword");
            string sMsg        = string.Empty;
            string sAccountC   = UserBll.AccountSel(iUserID).Trim();
            string sOPassWord  = UserBll.PassWordMD5(sAccountC, bpassword);
            int    iRes        = UserBll.PWDVal(iUserID, sOPassWord);

            if (iRes > 999)
            {
                string sMD5PassWord = UserBll.PassWordMD5(sAccountC, passwordtwo);
                if (1 == UserBll.UserUpdatePWD(iUserID, sMD5PassWord))
                {
                    sMsg = "0";
                }
                else
                {
                    sMsg = "1";
                }
            }
            else
            {
                string sMD5PassWordNew = UserBll.PassWordMD5New(sAccountC, bpassword);
                iRes = UserBll.PWDVal(iUserID, sMD5PassWordNew);
                if (iRes > 999)
                {
                    string sMD5PassWord = UserBll.PassWordMD5(sAccountC, passwordtwo);
                    if (1 == UserBll.UserUpdatePWD(iUserID, sMD5PassWord))
                    {
                        ClearUsersInfo();
                        sMsg = "0";
                    }
                    else
                    {
                        sMsg = "1";
                    }
                }
                else
                {
                    sMsg = "2";
                }
            }
            return(sMsg);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //获取Authorization Code
            string usercancel = CYRequest.GetQueryString("usercancel", false);

            if (usercancel.Length == 0)
            {
                //通过Authorization Code获取Access Token
                string code         = CYRequest.GetQueryString("code", false);
                string state        = CYRequest.GetQueryString("state", false);
                string sMD5State    = CYRequest.GetQueryString("ms", false);
                string sMD5StateVal = ProvideCommon.MD5(state);
                if (sMD5State == sMD5StateVal)
                {
                    string redirect_uri = Server.UrlEncode(string.Format("http://game.dao50.com/Services/qqCallBack.aspx?ms={0}", sMD5StateVal));
                    string sAccessToken = QQLogin.GetAccessToken(redirect_uri, code);
                    string sOpenID      = QQLogin.GetOpenID(sAccessToken);
                    //判断openid是否存在
                    int iUserID = QQUserBLL.QQUserUseridSelByOpenID(sOpenID);
                    if (iUserID < 1000)
                    {
                        string sNickName = QQLogin.GetNickName(sAccessToken, sOpenID);
                        string sAccount  = QQLogin.GetAccount(sNickName);
                        int    iType     = 3;
                        int    iUID      = UserBll.UserReg(sAccount, sOpenID, iType);
                        if (-1 == iUID)
                        {
                            Response.Write("<script>alert('注册失败,请重试!location.href='http://www.dao50.com/';')</script>");
                            return;
                        }
                        else if (iUID > 999)
                        {
                            UserInfo uiObject = new UserInfo();
                            uiObject.Credennum = "";
                            uiObject.Answer    = "";
                            uiObject.Email     = "";
                            uiObject.Name      = sNickName;
                            uiObject.question  = "";
                            uiObject.regip     = ProvideCommon.GetRealIP();
                            uiObject.uid       = iUID;
                            UserInfoBLL.UserInfoAdd(uiObject);
                            string sPageUrl = Request.Url.ToString();
                            QQUserBLL.QQUserAdd(iUID, sOpenID, sPageUrl);
                            LoginStateSet(sAccount, iUID, sPageUrl);
                            string sWUrl   = WebConfig.BaseConfig.sWUrl;
                            string sWWWUrl = string.Format("{0}/{1}?un={2}", sWUrl, "usercookie.aspx", sAccount);
                            string sKey    = ConfigurationManager.AppSettings["UserValKey"].ToString();
                            string sBBSUrl = DiscuzUserI.BBSLogin(sAccount, sOpenID, sKey);
                            string sJSUrl  = string.Format("<script src='{0}'></script><script src='{1}'></script>", sBBSUrl, sWWWUrl);
                            Response.Write(string.Format("{0}<script>alert('注册成功!');location.href='http://www.dao50.com/';</script>", sJSUrl));
                            return;
                        }
                    }
                    else
                    {
                        string sAccount = UserBll.AccountSel(iUserID).Trim();
                        int    iPoints  = UserPointsBLL.UPointAllSel(iUserID);
                        string sKey     = ConfigurationManager.AppSettings["UserValKey"].ToString();
                        string sUrl     = DiscuzUserI.BBSLogin(sAccount, sOpenID, sKey);
                        string sPageUrl = Request.Url.ToString();
                        LoginStateSet(sAccount, iUserID, sPageUrl);
                        string sCUrl  = WebConfig.BaseConfig.sWUrl;
                        string sJSUrl = string.Format("{0}/{1}?un={2}", sCUrl, "usercookie.aspx", sAccount);
                        Response.Write(string.Format("<script src='{0}'></script><script src='{1}'></script><script>location.href='{2}'</script>",
                                                     sUrl, sJSUrl, sCUrl));
                    }
                }
                else
                {
                    Response.Write("state err");
                }
            }
            else
            {
                Response.Write("<script>alert('登陆失败!location.href='http://www.dao50.com/';')</script>");
                return;
            }
        }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!(LoginSessionVal() || isLoginCookie()))
     {
         Response.Redirect(string.Format("{0}/Default.aspx", sRootUrl), true);
         return;
     }
     else
     {
         int      iUserID     = GetUserID();
         DateTime dtLoginTime = GetLoginTime();
         if (!PWDUpdateBLL.PwdUpdateVal(iUserID, dtLoginTime))
         {
             ClearUsersInfo();
             Response.Redirect(string.Format("{0}/Default.aspx", sRootUrl), true);
             return;
         }
     }
     iPoints  = GetUPoints();
     sAccount = GetAccount();
     if (Request.HttpMethod == "POST")
     {
         int    iUserID    = GetUserID();
         string sPassWord  = CYRequest.GetFormString("passwordtwo");
         string sAccountC  = UserBll.AccountSel(iUserID).Trim();
         string sOPassWord = UserBll.PassWordMD5(sAccountC, CYRequest.GetFormString("bpassword"));
         int    iRes       = UserBll.PWDVal(iUserID, sOPassWord);
         if (iRes > 999)
         {
             string sMD5PassWord = UserBll.PassWordMD5(sAccountC, sPassWord);
             if (1 == UserBll.UserUpdatePWD(iUserID, sMD5PassWord))
             {
                 ClearUsersInfo();
                 sMsg = "<script>alert('修改密码成功!请重新登陆!');location.href='../Default.aspx';</script>";
             }
             else
             {
                 //更新失败
                 sMsg = "<script>alert('修改密码失败!');</script>";
             }
         }
         else
         {
             string sMD5PassWordNew = UserBll.PassWordMD5New(sAccountC, CYRequest.GetFormString("bpassword"));
             iRes = UserBll.PWDVal(iUserID, sMD5PassWordNew);
             if (iRes > 999)
             {
                 string sMD5PassWord = UserBll.PassWordMD5(sAccountC, sPassWord);
                 if (1 == UserBll.UserUpdatePWD(iUserID, sMD5PassWord))
                 {
                     ClearUsersInfo();
                     sMsg = "<script>alert('修改密码成功!请重新登陆!');location.href='../Default.aspx';</script>";
                 }
                 else
                 {
                     //更新失败
                     sMsg = "<script>alert('修改密码失败!');</script>";
                 }
             }
             else
             {
                 sMsg = "<script>alert('原始密码输入错误!');</script>";
             }
         }
     }
 }
Exemplo n.º 5
0
        public string FirstGift(string sGameName, int iUserID)
        {
            if (iUserID < 1000000)
            {
                return("useriderr!");
            }
            string sBeginTime = ServerBLL.ServerTimeSel(sGameName);

            if (!FirstGiftBLL.valTime(sBeginTime))
            {
                return("timeerr");
            }
            if (Request.UrlReferrer.Host.Length < 6)
            {
                return("hostlenerr");
            }
            if (Request.UrlReferrer.Host.Split('.').Length < 2)
            {
                return("hosterr");
            }
            string sFromHost  = Request.UrlReferrer.Host.Split('.')[1];
            string sAccount   = UserBll.AccountSel(iUserID).Trim();
            string sGiftState = FirstGiftBLL.GiftStateSel(iUserID, sGameName);
            string sRes       = string.Empty;
            int    iPoint     = 10;
            string sTranIP    = ProvideCommon.GetRealIP();
            string sGiftRes   = string.Empty;

            switch (sGiftState)
            {
            case "0":
                sGiftRes = FirstGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP, sFromHost);
                if (sGiftRes == "0")
                {
                    sRes = "0";
                    FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 1);
                }
                else
                {
                    sRes = sGiftRes;
                }
                break;

            case "1":
                sRes = "1";
                break;

            case "2":
                sRes = "7";
                break;

            default:
                string sLevel = FirstGiftBLL.ULevelSel(iUserID, sGameName);
                int    iLevel = 0;
                int.TryParse(sLevel, out iLevel);
                if (iLevel > 29)
                {
                    FirstGiftBLL.GiftAdd(iUserID, iLevel, sGameName);
                    sGiftRes = FirstGiftBLL.GiftToGame(iUserID, sGameName, sAccount, iPoint, sTranIP, sFromHost);
                    if (sGiftRes == "0")
                    {
                        FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 1);
                        sRes = "0";
                    }
                    else
                    {
                        FirstGiftBLL.GiftStateUpate(iUserID, sGameName, 0);
                        sRes = sGiftRes;
                    }
                }
                else
                {
                    sRes = "2";
                }
                break;
            }
            return(sRes);
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string sTranID    = CYRequest.GetQueryString("TranID");
            int    iPayUserID = TransGBLL.TransSelGUserIDByTID(sTranID);

            sPayAccount = UserBll.AccountSel(iPayUserID).Trim();
            iGamePoints = TransGBLL.TransGamePointsSelByTID(sTranID);
            string sAbbre  = CYRequest.GetQueryString("gn");
            string sType   = CYRequest.GetQueryString("type");
            string sGAbbre = GameInfoBLL.GameInfoAbbreSel(sAbbre).Trim();

            switch (sGAbbre)
            {
            case "sssg":
                sGameName = "盛世三国";
                sGameM    = "银(注:1000银=1锭)";
                break;

            case "sxd":
                sGameName = "神仙道";
                sGameM    = "元宝";
                break;

            case "lj":
                sGameName = "龙将";
                sGameM    = "金币";
                break;

            case "yjxy":
                sGameName = "一剑轩辕";
                sGameM    = "元宝";
                break;

            case "dxz":
                sGameName = "大侠传";
                sGameM    = "黄金";
                break;

            case "djj":
                sGameName = "大将军";
                sGameM    = "黄金";
                break;

            case "txj":
                sGameName = "天行剑";
                sGameM    = "元宝";
                break;

            case "sjsg":
                sGameName = "神将三国";
                sGameM    = "元宝";
                break;

            case "tzcq":
                sGameName = "天尊传奇";
                sGameM    = "元宝";
                break;

            case "zsg":
                sGameName = "战三国";
                sGameM    = "元宝";
                break;

            case "wssg":
                sGameName = "无双三国";
                sGameM    = "元宝";
                break;

            case "by":
                sGameName = "霸域";
                sGameM    = "元宝";
                break;

            case "mxqy":
                sGameName = "冒险契约";
                sGameM    = "金币";
                break;

            case "swjt":
                sGameName = "神武九天";
                sGameM    = "元宝";
                break;

            case "gcld":
                sGameName = "攻城掠地";
                sGameM    = "金币";
                break;

            case "tjz":
                sGameName = "天劫传";
                sGameM    = "元宝";
                break;

            case "khbd":
                sGameName = "葵花宝典";
                sGameM    = "元宝";
                break;

            case "sglj":
                sGameName = "三国论剑";
                sGameM    = "通宝";
                break;

            case "hyjft":
                sGameName = "火影疾风坛";
                sGameM    = "金币";
                break;

            case "llsg":
                sGameName = "龙狼三国";
                sGameM    = "黄金";
                break;

            case "nslm":
                sGameName = "女神联盟";
                sGameM    = "钻石";
                break;

            case "rxzt":
                sGameName = "热血遮天";
                sGameM    = "元宝";
                break;

            case "ahxy":
                sGameName = "暗黑西游";
                sGameM    = "元宝";
                break;

            case "mhxy":
                sGameName = "梦回轩辕";
                sGameM    = "元宝";
                break;

            case "sxj":
                sGameName = "神仙劫";
                sGameM    = "元宝";
                break;

            case "zwj":
                sGameName = "最无极";
                sGameM    = "元宝";
                break;

            case "qxz":
                sGameName = "群侠传";
                sGameM    = "元宝";
                break;

            case "qszg":
                sGameName = "骑士战歌";
                sGameM    = "金币";
                break;

            case "wwsg":
                sGameName = "威武三国";
                sGameM    = "元宝";
                break;

            case "dntg":
                sGameName = "大闹天宫";
                sGameM    = "元宝";
                break;

            case "ahxx":
                sGameName = "暗黑修仙";
                sGameM    = "元宝";
                break;

            case "jjp":
                sGameName = "将军破";
                sGameM    = "元宝";
                break;

            case "sgyjz":
                sGameName = "三国英杰传";
                sGameM    = "金币";
                break;

            case "dtgzt":
                sGameName = "太古遮天";
                sGameM    = "元宝";
                break;

            case "dtgzter":
                sGameName = "太古遮天2";
                sGameM    = "元宝";
                break;
            }
            if ("q" == sType)
            {
                sAccount    = sPayAccount;
                iUserPoints = UserPointsBLL.UPointAllSel(iPayUserID);
            }
            else
            {
                int iUserID = GetUserID();
                if (iUserID > 999)
                {
                    iUserPoints = UserPointsBLL.UPointAllSel(iUserID);
                    sAccount    = GetAccount();
                }
            }
            SetPoints(iUserPoints);
            string sFromHost = GetFromHost();

            if (sFromHost.Length > 5)
            {
                string sServerNum         = sAbbre.Replace(sGAbbre, "");
                string sQueryString       = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}", sTranID, sGameName, sServerNum, sPayAccount, sAccount, iGamePoints, iUserPoints, sGameM);
                string sEncodeQueryString = Server.UrlEncode(sQueryString);
                string sGoUrl             = string.Format("http://{0}/PayGSucc.html?{1}", sFromHost, sEncodeQueryString);
                Response.Redirect(sGoUrl, true);
                return;
            }
        }