Esempio n. 1
0
 /// <summary>
 /// 获取游客的所在地
 /// </summary>
 private void GetIpList()
 {
     try
     {
         string[]      ipList  = Utils.SplitString(DNTRequest.GetString("iplist"), ",");
         string[]      pidList = Utils.SplitString(DNTRequest.GetString("pidlist"), ",");
         StringBuilder sb      = new StringBuilder();
         sb.Append("[");
         for (int i = 0; i < ipList.Length; i++)
         {
             sb.Append("'");
             sb.Append(pidList[i]);
             sb.Append("|");
             sb.Append(IpSearch.GetAddressWithIP(ipList[i].Replace("*", "1")));
             sb.Append("'");
             sb.Append(",");
         }
         ResponseJSON(sb.ToString().TrimEnd(',') + "]");
     }
     catch //添加try语法, 以防止在并发情况下, 服务器端远程链接被关闭后出现应用程序 '警告'(事件查看器)
     {
         System.Web.HttpContext.Current.Response.Clear();
         System.Web.HttpContext.Current.Response.Expires = 0;
         System.Web.HttpContext.Current.Response.Cache.SetNoStore();
         System.Web.HttpContext.Current.Response.End();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 资讯的浏览量
        /// </summary>
        private void UpdateViews()
        {
            int    typeId    = CRequest.GetInt("typeId", 0);
            string pageName  = CRequest.GetString("pageName");
            string pageValue = CRequest.GetString("pageValue");

            //Pv统计
            #region
            Pv pv = new Pv();
            pv.pageName   = pageName;
            pv.pageValue  = pageValue;
            pv.viewsCount = 1;
            string sUserAgent  = Request.UserAgent.ToLower();
            bool   bIsIpad     = Regex.IsMatch(sUserAgent, "ipad");
            bool   bIsIphoneOs = Regex.IsMatch(sUserAgent, "iphone");
            bool   bIsAndroid  = Regex.IsMatch(sUserAgent, "android");
            bool   bIsWP       = Regex.IsMatch(sUserAgent, "windows phone");
            if (bIsAndroid || bIsIphoneOs || bIsIpad || bIsWP)
            {
                pv.viewsCount = 2;
            }
            pv.addTime  = DateTime.Now;
            pv.ip       = IpSearch.GetIp();
            pv.status   = 0;
            pv.remark   = "";
            pv.infoType = typeId;
            UserInfo user = Session["user"] as UserInfo;
            if (user != null)
            {
                pv.status = user.id;
                pv.remark = user.mobile;
            }
            PvService.Add(pv);
            #endregion
        }
Esempio n. 3
0
        /// <summary>
        /// 加载信息
        /// </summary>
        private void LoadViewInfo()
        {
            string ip    = txtIP.Text.Trim();
            string tFrom = txtTimeFrom.Text.Trim();
            string tEnd  = this.txtTimeEnd.Text.Trim();

            ViewState["IP"] = IpSearch.GetIp();

            StringBuilder sb = new StringBuilder();

            sb.Append("1=1");
            if (ip.Length != 0)
            {
                sb.Append(" and ip <> '" + ip + "'");
            }
            if (tFrom.Length != 0)
            {
                sb.Append(" and addTime >= '" + Convert.ToDateTime(tFrom) + "'");
            }
            if (tEnd.Length != 0)
            {
                sb.Append(" and addTime <= '" + Convert.ToDateTime(tEnd).ToString("yyyy-MM-dd") + " 23:59:59'");
            }

            ViewState["index"]      = PvService.GetViews(sb.ToString(), "index.aspx");
            ViewState["reg"]        = PvService.GetViews(sb.ToString(), "reg.aspx");
            ViewState["login"]      = PvService.GetViews(sb.ToString(), "login.aspx");
            ViewState["searchList"] = PvService.GetViews(sb.ToString(), "searchList.aspx");

            ViewState["comDetail_client"] = PvService.GetViews(sb.ToString(), "comDetail_client.aspx");
            ViewState["findPass"]         = PvService.GetViews(sb.ToString(), "findPass.aspx");

            ViewState["m_comDetail"] = PvService.GetViews(sb.ToString(), "m_comDetail.aspx");



            ViewState["protocol"]     = PvService.GetViews(sb.ToString(), "protocol.aspx");
            ViewState["storeList"]    = PvService.GetViews(sb.ToString(), "storeList.aspx");
            ViewState["storeMoney"]   = PvService.GetViews(sb.ToString(), "storeMoney.aspx");
            ViewState["userCenter"]   = PvService.GetViews(sb.ToString(), "userCenter.aspx");
            ViewState["userList"]     = PvService.GetViews(sb.ToString(), "userList.aspx");
            ViewState["viewsHistory"] = PvService.GetViews(sb.ToString(), "viewsHistory.aspx");
        }
Esempio n. 4
0
        protected override void ShowPage()
        {
            if (postid == 0)
            {
                base.AddErrLine("指定的主题不存在或已被删除或正在被审核,请返回.");
                return;
            }

            PostInfo postInfo = Posts.GetPostInfo(topicid, postid);

            if (postInfo == null)
            {
                base.AddErrLine("指定的主题不存在或已被删除或正在被审核,请返回.");
                return;
            }

            ip         = postInfo.Ip;
            iplocation = IpSearch.GetAddressWithIP(ip);

            // 如果数据库文件不存在
            if (iplocation == null)
            {
                iplocation = "(IP数据库文件不存在,无法查询)";
            }
            else if (iplocation == "") // 如果没有查到
            {
                iplocation = "没有查询到该用户的地理所在地";
            }

            // 获取该主题的信息
            TopicInfo topic = Topics.GetTopicInfo(postInfo.Tid);

            // 如果该主题不存在
            if (topic == null)
            {
                AddErrLine("不存在的主题ID");
                return;
            }

            ForumInfo forum = Forums.GetForumInfo(postInfo.Fid);

            forumname = forum.Name;
            pagetitle = topic.Title;
            forumnav  = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);

            AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid);

            if (admininfo == null || admininfo.Allowviewip != 1)
            {
                AddErrLine("你没有查看IP的权限");
                return;
            }
            if (DNTRequest.GetString("action") == "ipban")
            {
                if (admininfo.Allowbanip != 1)
                {
                    AddErrLine("你无权禁止用户IP,请返回");
                    return;
                }
                if (Utils.InIPArray(DNTRequest.GetString("ip"), Utils.SplitString(config.Ipdenyaccess, "\n")))
                {
                    Users.UpdateUserGroup(postInfo.Posterid, 6);
                    AddErrLine("IP已在列表中存在,无需重复添加");
                    return;
                }
                if (GeneralConfigs.SetIpDenyAccess(DNTRequest.GetString("ip")))
                {
                    //调整用户到禁止IP组
                    Users.UpdateUserGroup(postInfo.Posterid, 6);

                    SetUrl(base.ShowTopicAspxRewrite(topic.Tid, 0));
                    SetMetaRefresh();
                    SetShowBackLink(false);
                    MsgForward("getip_succeed");
                    base.AddMsgLine("IP已加入到用户禁止列表中");
                    base.ispost = true;
                }
                else
                {
                    base.AddErrLine("未知原因,IP无法加到禁止列表中");
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// SaveMy Business Center
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            string surname    = this.surname.Text.Trim();
            string relname    = this.relname.Text.Trim();
            string shoperName = this.shoperName.Text.Trim();
            string street     = this.street.Text.Trim();
            string city       = this.city.Text.Trim();
            string province   = this.province.Text.Trim();
            string email      = this.email.Text.Trim();
            string remark     = this.remark.Text.Trim();

            string password = this.password.Text.Trim();

            if (password.Length == 0)
            {
                password = "******";
            }
            string mobile  = this.tel.Text.Trim();
            string md5Pass = encrypt.EncryptMd5(password);

            UserInfo user = null;

            if (UserInfoService.ExistsMobile(mobile))
            {
                ScriptManager.RegisterStartupScript(Button1, GetType(), "", "alert('This phone number has already joined.');", true);
                return;
            }
            user              = new UserInfo();
            user.username     = surname;
            user.mobile       = mobile;
            user.isBindMobile = 1;
            user.email        = email;
            user.isBindEmail  = 0;
            user.password     = password;
            user.md5Pass      = encrypt.EncryptMd5(password);
            user.telephone    = "";
            user.relName      = relname;
            user.bodyCode     = "";
            user.comName      = shoperName;
            user.pid          = 0;
            user.cid          = 0;
            user.regionId     = 0;
            user.address      = "";
            user.zipCode      = "";
            user.qq           = "";
            user.weixin       = "";
            user.isBindWeiXin = 0;
            user.weibo        = "";
            user.isBindWeiBo  = 0;
            user.shopType     = 0;
            user.shopTypeName = "";
            user.imgUrl       = "";
            user.comInfo      = "";
            user.remark       = remark;
            user.status       = 1;
            user.addTime      = DateTime.Now;
            user.mobileCode   = street;
            user.activeCode   = city;
            user.infoType     = 2;
            user.shopingtime  = "";

            user.mainbrand   = province;
            user.assesscount = 0;
            user.sharecount  = 0;
            user.producttype = 0;
            user.goodcount   = 0;
            user.badcount    = 0;
            user.viewscountd = 0;
            user.logintime   = DateTime.Now;
            user.loginip     = IpSearch.GetIp();

            int maxId = UserInfoService.Add(user);

            if (maxId > 0)
            {
                ScriptManager.RegisterStartupScript(Button1, GetType(), "", "alert('Saved succesfully!');location.href='/mobile/joinBack.aspx';", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Button1, GetType(), "", "alert('Failed to save!');", true);
                return;
            }
        }