protected override void ShowPage() { this.pagetitle = "用户控制面板"; if (!base.IsLogin()) { return; } if (DNTRequest.IsPost()) { if (ForumUtils.IsCrossSitePost()) { base.AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } bool flag = true; //switch (this.config.Passwordmode) //{ // case 0: flag = Utils.MD5(DNTRequest.GetString("password")).EqualIgnoreCase(this.password); // break; // case 1: // flag = (Utils.MD5(DNTRequest.GetString("password")) != this.password); // break; // default: // if (PasswordModeProvider.GetInstance() != null) // { // flag = !PasswordModeProvider.GetInstance().CheckPassword(this.user, DNTRequest.GetString("password")); // } // break; //} if (flag) { base.AddErrLine("密码错误"); return; } int paynum = DNTRequest.GetInt("paynum", 0); if (paynum <= 0) { base.AddErrLine("数量必须是大于等于0的整数"); return; } int userId = Users.GetUserId(DNTRequest.GetString("fromto").Trim()); if (userId <= 0) { base.AddErrLine("指定的转帐接受人不存在"); return; } int int2 = DNTRequest.GetInt("extcredits", 0); if (int2 < 1 || int2 > 8) { base.AddErrLine("请正确选择要转帐的积分类型!"); return; } string text = Scoresets.GetScoreSet(int2).Name.Trim(); if (text.IsNullOrEmpty()) { base.AddErrLine("错误的输入!"); return; } if (Users.GetUserExtCredits(this.userid, int2) - (float)paynum < (float)Scoresets.GetTransferMinCredits()) { base.AddErrLine(string.Format("抱歉, 您的 \"{0}\" 不足.系统当前规定转帐余额不得小于{1}", text, Scoresets.GetTransferMinCredits().ToString())); return; } var num = (Int32)Math.Round((double)((float)paynum * (1f - this.creditstax)), 2); BBX.Entity.User.UpdateUserExtCredits(this.userid, int2, (float)(paynum * -1)); BBX.Entity.User.UpdateUserExtCredits(userId, int2, num); //CreditsLogs.AddCreditsLog(this.userid, userId, int2, int2, (float)@int, num, Utils.GetDateTime(), 2); CreditsLog.Add(this.userid, userId, int2, int2, paynum, num, 2); base.SetUrl("usercpcreaditstransferlog.aspx"); base.SetMetaRefresh(); base.SetShowBackLink(false); base.AddMsgLine("积分转帐完毕, 正在返回积分兑换与转帐记录"); } }
protected override void ShowPage() { pagetitle = "用户控制面板"; if (!IsLogin()) { return; } if (DNTRequest.IsPost()) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } bool isPasswordError = true; switch (config.Passwordmode) { case 1: //动网兼容模式 { isPasswordError = Utils.MD5(DNTRequest.GetString("password")) != password; break; } case 0: //默认模式 { isPasswordError = Utils.MD5(DNTRequest.GetString("password")) != password; break; } default: //第三方加密验证模式 { if (PasswordModeProvider.GetInstance() != null) { isPasswordError = !PasswordModeProvider.GetInstance().CheckPassword(user, DNTRequest.GetString("password")); } break; } } if (isPasswordError) { AddErrLine("密码错误"); return; } int paynum = DNTRequest.GetInt("paynum", 0); if (paynum <= 0) { AddErrLine("数量必须是大于等于0的整数"); return; } int fromto = Users.GetUserId(DNTRequest.GetString("fromto").Trim()); if (fromto == -1) { AddErrLine("指定的转帐接受人不存在"); return; } int extcredits = DNTRequest.GetInt("extcredits", 0); if (extcredits < 1 || extcredits > 8) { AddErrLine("请正确选择要转帐的积分类型!"); return; } //对转帐后的积分增减进行修改设置 string extcreditsName = Scoresets.GetScoreSet(extcredits).Name.Trim(); if (Utils.StrIsNullOrEmpty(extcreditsName)) { AddErrLine("错误的输入!"); return; } if ((Users.GetUserExtCredits(userid, extcredits) - paynum) < Scoresets.GetTransferMinCredits()) { AddErrLine(string.Format("抱歉, 您的 \"{0}\" 不足.系统当前规定转帐余额不得小于{1}", extcreditsName, Scoresets.GetTransferMinCredits().ToString())); return; } //计算并更新2个扩展积分的新值 float toPayNum = (float)Math.Round(paynum * (1 - creditstax), 2); Users.UpdateUserExtCredits(userid, extcredits, paynum * -1); Users.UpdateUserExtCredits(fromto, extcredits, toPayNum); CreditsLogs.AddCreditsLog(userid, fromto, extcredits, extcredits, paynum, toPayNum, Utils.GetDateTime(), 2); SetUrl("usercpcreaditstransferlog.aspx"); SetMetaRefresh(); SetShowBackLink(false); AddMsgLine("积分转帐完毕, 正在返回积分兑换与转帐记录"); } }
protected override void ShowPage() { pagetitle = "用户控制面板"; creditstax = Scoresets.GetCreditsTax(); if (userid == -1) { AddErrLine("你尚未登录"); return; } user = Discuz.Forum.Users.GetUserInfo(userid); if (DNTRequest.IsPost()) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } if (Utils.MD5(DNTRequest.GetString("password")) != password) { AddErrLine("密码错误"); return; } int paynum = DNTRequest.GetInt("paynum", 0); if (paynum <= 0) { AddErrLine("数量必须是大于等于0的整数"); return; } int fromto = Discuz.Forum.Users.GetUserID(DNTRequest.GetString("fromto").Trim()); if (fromto == -1) { AddErrLine("指定的转帐接受人不存在"); return; } int extcredits = DNTRequest.GetInt("extcredits", 0); if (extcredits < 1 || extcredits > 8) { AddErrLine("请正确选择要转帐的金币类型!"); return; } //对转帐后的金币增减进行修改设置 UserExtcreditsInfo extcreditsinfo = Scoresets.GetScoreSet(extcredits); if (extcreditsinfo.Name.Trim() == "") { AddErrLine("错误的输入!"); return; } //UserInfo __userinfo = Discuz.Forum.Users.GetUserInfo(userid); if ((Discuz.Forum.Users.GetUserExtCredits(userid, extcredits) - paynum) < Scoresets.GetTransferMinCredits()) { AddErrLine(string.Format("抱歉, 您的 \"{0}\" 不足.系统当前规定转帐余额不得小于{1}", extcreditsinfo.Name, Scoresets.GetTransferMinCredits().ToString())); return; } //计算并更新2个扩展金币的新值 float topaynum = (float)Math.Round(paynum * (1 - creditstax), 2); Discuz.Forum.Users.UpdateUserExtCredits(userid, extcredits, paynum * -1); Discuz.Forum.Users.UpdateUserExtCredits(fromto, extcredits, topaynum); CreditsLogs.AddCreditsLog(userid, fromto, extcredits, extcredits, paynum, topaynum, Utils.GetDateTime(), 2); SetUrl("usercpcreaditstransferlog.aspx"); SetMetaRefresh(); SetShowBackLink(false); AddMsgLine("金币转帐完毕, 正在返回金币兑换与转帐记录"); } score = Scoresets.GetValidScoreName(); extcreditspaylist = Scoresets.GetScorePaySet(1); }