Ejemplo n.º 1
0
    /// <summary>
    /// IP统计
    /// </summary>
    private void IpPage()
    {
        //计算总量
        int total = new BCW.BLL.Statinfo().GetCount("");

        builder.Append(Out.Tab("<div>", "<br />"));
        builder.Append("累计流量" + total + "");
        builder.Append(Out.Tab("</div>", ""));

        builder.Append(Out.Tab("<div>", "<br />"));
        builder.Append("IP|访问量|比例");
        builder.Append(Out.Tab("</div>", "<br />"));

        int pageIndex;
        int recordCount;
        int pageSize = Convert.ToInt32(ub.Get("SiteListNo"));

        string[] pageValUrl = { "ptype" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }

        // 开始读取列表
        IList <BCW.Model.Statinfo> listStatinfo = new BCW.BLL.Statinfo().GetIPs(pageIndex, pageSize, out recordCount);

        if (listStatinfo.Count > 0)
        {
            int k = 1;
            foreach (BCW.Model.Statinfo n in listStatinfo)
            {
                if (k % 2 == 0)
                {
                    builder.Append(Out.Tab("<div>", "<br />"));
                }
                else
                {
                    if (k == 1)
                    {
                        builder.Append(Out.Tab("<div>", ""));
                    }
                    else
                    {
                        builder.Append(Out.Tab("<div>", "<br />"));
                    }
                }

                string ipCity = new IPSearch().GetAddressWithIP(n.IP);
                if (!string.IsNullOrEmpty(ipCity))
                {
                    ipCity = ipCity.Replace("IANA保留地址  CZ88.NET", "本机地址").Replace("CZ88.NET", "") + ":";
                }
                if (!Utils.Isie())
                {
                    builder.Append(ipCity + "" + n.IP + "—" + n.IpCount + "—" + (Convert.ToInt32(Percent(n.IpCount, total) * 100)) + "%");
                }
                else
                {
                    builder.Append(ipCity + "" + n.IP + "—" + n.IpCount + "—<img src=\"/Files/sys/bar.gif\" height=\"10\" width=\"" + Percent(n.IpCount, total) * 100 + "\" />" + Convert.ToInt32(Percent(n.IpCount, total) * 100) + "%");
                }

                k++;
                builder.Append(Out.Tab("</div>", ""));
            }

            // 分页
            builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0));
        }
        else
        {
            builder.Append(Out.Div("div", "没有相关记录.."));
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //DataSet ds = new BCW.BLL.Text().GetList("id", "select  from tb_tbapay where group by id having count(*)>1");

        //DataSet ds = new TPR2.BLL.guess.BaPay().GetBaPayList("id", "dt>=0 group by id having count(*)>1");

        DataSet ds = BCW.Data.SqlHelper.Query("select Mobile,EndIP from tb_User  where IsVerify=1");

        if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string EndIP  = ds.Tables[0].Rows[i]["EndIP"].ToString();
                string Mobile = ds.Tables[0].Rows[i]["Mobile"].ToString();

                string ipCity = string.Empty;
                if (!string.IsNullOrEmpty(EndIP))
                {
                    ipCity = new IPSearch().GetAddressWithIP(EndIP);
                    if (!string.IsNullOrEmpty(ipCity))
                    {
                        ipCity = ipCity.Replace("IANA保留地址  CZ88.NET", "本机地址").Replace("CZ88.NET", "") + ":";
                    }
                    if (!ipCity.Contains("肇庆"))
                    {
                        builder.Append("" + Mobile + "<br />");
                    }
                }
            }
        }



        //DataSet ds = new BCW.BLL.Goldlog().GetList("usid,Sum(AcGold) as cent", "Types=0 and addtime>'2014-3-1 12:00:00' and addtime<'2014-3-20 15:00:00' and PUrl LIKE '/bbs/guess%' group by usid");

        //int iTar = 50;
        //if (ds != null && ds.Tables[0].Rows.Count > 0)
        //{
        //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        //    {

        //        int usid = int.Parse(ds.Tables[0].Rows[i]["usid"].ToString());
        //        long Cents = Convert.ToInt64(ds.Tables[0].Rows[i]["cent"].ToString());
        //        if (Cents < 0)
        //        {

        //            long cent = Convert.ToInt64((-Cents) * (iTar * 0.001));
        //            new BCW.BLL.User().UpdateiGold(usid, cent, "竞猜返负(含半场单节)");
        //            //发内线
        //            string strLog = "根据你上期竞猜(含半场单节)排行榜上的亏损情况,系统自动返还了" + cent + "" + ub.Get("SiteBz") + "[url=/bbs/guess2/default.aspx]进入球彩竞猜[/url]";
        //            new BCW.BLL.Guest().Add(0, usid, new BCW.BLL.User().GetUsName(usid), strLog);

        //            builder.Append(usid + "|" + Cents + "|" +cent + "<br />");
        //        }
        //    }
        //}


        ////注册一万个ID
        //int k = 0;
        //for (int i = 0; i < 2000; i++)
        //{

        //    Random ra = new Random(unchecked((int)DateTime.Now.Ticks));
        //    string mobile = "15107582999";

        //    //取得会员ID
        //    int maxId = BCW.User.Reg.GetRandId();
        //    if (maxId == 0 || maxId.ToString().Length != 5)//
        //    {
        //        continue;
        //    }

        //    //加密用户密码
        //    string strPwd = Utils.MD5Str(new Rand().RandNum(10) + ra.Next(10000, 1000000));
        //    //取随机识别串
        //    string UsKey = new Rand().RandNum(10);


        //    //写入注册表
        //    BCW.Model.User model = new BCW.Model.User();
        //    model.ID = maxId;
        //    model.Mobile = mobile;
        //    model.UsName = "" + ub.Get("SiteText") + "网" + maxId + "";
        //    model.UsPwd = strPwd;
        //    model.UsKey = UsKey;
        //    model.Photo = "/Files/Avatar/image0.gif";
        //    model.Sex = ra.Next(1, 3);
        //    model.RegTime = DateTime.Parse("2013-" + ra.Next(1, 9) + "-" + ra.Next(1, 29) + "");
        //    model.RegIP = Utils.GetUsIP();
        //    model.EndTime = DateTime.Now;
        //    model.Birth = DateTime.Parse("" + ra.Next(1980, 1999) + "-" + ra.Next(1, 9) + "-" + ra.Next(1, 29) + "");
        //    model.Sign = "未设置签名";
        //    model.InviteNum = 0;
        //    model.IsVerify = 1;
        //    model.Email = "";
        //    new BCW.BLL.User().Add(model);
        //    //积分操作
        //    new BCW.User.Cent().UpdateCent(BCW.User.Cent.enumRole.Cent_RegUser, maxId);

        //    //城市就随机分配
        //    string sCity = Utils.DelLastChar(BCW.User.City.GetCity(), "#");
        //    string[] sNum = sCity.Split("#".ToCharArray());
        //    Random rd = new Random();
        //    string City = sNum[rd.Next(sNum.Length)];

        //    long iScore = ra.Next(800, 2000);
        //    int Click = ra.Next(10, 300);
        //    int Leven = ra.Next(1, 9);
        //    int OnTime = ra.Next(500, 20000);
        //    BCW.Data.SqlHelper.ExecuteSql("update tb_user set City='" + City + "',iScore=" + iScore + ",Click=" + Click + ",Leven=" + Leven + ",OnTime=" + OnTime + " where id=" + maxId + "");
        //    k++;
        //}

        //builder.Append("成功注册" + k + "个");
    }
Ejemplo n.º 3
0
    private void IpListPage()
    {
        Master.Title = "查看IP";
        int id    = int.Parse(Utils.GetRequest("id", "get", 1, @"^[0-9]\d*$", "0"));
        int ptype = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[0-2]\d*$", "0"));

        builder.Append(Out.Tab("<div class=\"title\">", ""));
        if (id > 0)
        {
            builder.Append(new BCW.BLL.Link().GetLinkName(id));
        }
        builder.Append("IP记录");
        builder.Append(Out.Tab("</div>", "<br />"));
        builder.Append(Out.Tab("<div class=\"text\">", ""));
        if (ptype == 0)
        {
            builder.Append("全部|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("link.aspx?act=iplist&amp;ptype=0&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">全部</a>|");
        }

        if (ptype == 1)
        {
            builder.Append("链入IP|");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("link.aspx?act=iplist&amp;ptype=1&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">链入IP</a>|");
        }

        if (ptype == 2)
        {
            builder.Append("链出IP");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("link.aspx?act=iplist&amp;ptype=2&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">链出IP</a>");
        }

        builder.Append(Out.Tab("</div>", "<br />"));
        int    pageIndex;
        int    recordCount;
        int    pageSize = Convert.ToInt32(ub.Get("SiteListNo"));
        string strWhere = "";

        string[] pageValUrl = { "act", "ptype", "id", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }
        //查询条件
        if (id > 0)
        {
            strWhere += "LinkId=" + id + "";
        }

        if (ptype > 0)
        {
            if (strWhere != "")
            {
                strWhere += " and Types=" + (ptype - 1) + "";
            }
            else
            {
                strWhere += "Types=" + (ptype - 1) + "";
            }
        }
        // 开始读取列表
        IList <BCW.Model.LinkIp> listLinkIp = new BCW.BLL.LinkIp().GetLinkIps(pageIndex, pageSize, strWhere, out recordCount);

        if (listLinkIp.Count > 0)
        {
            int k = 1;
            foreach (BCW.Model.LinkIp n in listLinkIp)
            {
                if (k % 2 == 0)
                {
                    builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
                }
                else
                {
                    if (k == 1)
                    {
                        builder.Append(Out.Tab("<div>", ""));
                    }
                    else
                    {
                        builder.Append(Out.Tab("<div>", "<br />"));
                    }
                }
                string ipCity = new IPSearch().GetAddressWithIP(n.AddUsIP);
                if (!string.IsNullOrEmpty(ipCity))
                {
                    ipCity = ipCity.Replace("IANA保留地址  CZ88.NET", "本机地址").Replace("CZ88.NET", "") + ":";
                }

                builder.Append("[" + ((pageIndex - 1) * pageSize + k) + "]");
                builder.Append(ipCity + "" + n.AddUsIP + "");
                builder.Append("浏览器:" + n.AddUsUA + "");

                if (!string.IsNullOrEmpty(n.AddUsPage))
                {
                    if (n.Types == 0)
                    {
                        builder.Append("来访页:" + Out.UBB(n.AddUsPage) + "");
                    }
                    else
                    {
                        builder.Append("去访页:" + Out.UBB(n.AddUsPage) + "");
                    }
                }
                builder.Append("[" + DT.FormatDate(n.AddTime, 12) + "]");
                k++;
                builder.Append(Out.Tab("</div>", ""));
            }

            // 分页
            builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 0));
        }
        else
        {
            builder.Append(Out.Div("div", "没有相关记录.."));
        }
        builder.Append(Out.Tab("<div>", "<br />"));
        builder.Append("温馨提示:IP记录只保留当天的记录.");
        builder.Append(Out.Tab("</div>", ""));
        builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
        builder.Append(Out.Tab("<div>", ""));
        if (id > 0)
        {
            builder.Append("<a href=\"" + Utils.getUrl("link.aspx?act=view&amp;id=" + id + "&amp;backurl=" + Utils.getPage(0) + "") + "\">查看友链</a><br />");
        }
        builder.Append("<a href=\"" + Utils.getPage("link.aspx") + "\">返回上一级</a><br />");
        builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
        builder.Append(Out.Tab("</div>", "<br />"));
    }
Ejemplo n.º 4
0
    private void OkPage()
    {
        string Name  = Utils.GetRequest("Name", "post", 2, @"^\d{1,10}$|^(?:13|14|15|18)\d{9}$", "请正确输入ID或者手机号");
        string Pwd   = Utils.GetRequest("Pwd", "post", 2, @"^[A-Za-z0-9]{6,20}$", "请正确输入您的密码");
        bool   IsMy  = bool.Parse(Utils.GetRequest("IsMy", "post", 1, @"^True|False$", "False"));
        int    State = int.Parse(Utils.GetRequest("State", "post", 1, @"^[0-1]$", "0"));

        int rowsAffected = 0;

        BCW.Model.User modellogin = new BCW.Model.User();
        modellogin.UsPwd = Utils.MD5Str(Pwd);
        if (Name.Length == 11)
        {
            modellogin.Mobile = Name;
            rowsAffected      = new BCW.BLL.User().GetRowByMobile(modellogin);
        }
        else
        {
            modellogin.ID = Convert.ToInt32(Name);
            rowsAffected  = new BCW.BLL.User().GetRowByID(modellogin);
        }

        if (rowsAffected > 0)
        {
            BCW.Model.User model = new BCW.Model.User();
            //if (Name.Length == 11)
            //{
            //    model = new BCW.BLL.User().GetKey(Name);
            //}
            //else
            //{
            //model = new BCW.BLL.User().GetKey(Convert.ToInt32(Name));
            //}

            model = new BCW.BLL.User().GetKey(rowsAffected);


            int    UsId     = model.ID;
            string UsKey    = model.UsKey;
            string UsPwd    = model.UsPwd;
            int    IsVerify = model.IsVerify;
            if (IsVerify == 2)
            {
                Utils.Error("您的ID还没有通过邮箱验证,如您没到验证邮件,<a href=\"" + Utils.getUrl("reg.aspx?act=reemail") + "\">请重试</a>", "");
            }
            string ac = Utils.GetRequest("ac", "all", 1, "", "");
            if (Utils.ToSChinese(ac) == "安全登录")
            {
                //取随机识别串
                UsKey = new Rand().RandNum(10);
                new BCW.BLL.User().UpdateUsKey(UsId, UsKey);
            }

            //加密用户密码
            string strPwd = Utils.MD5Str(UsPwd.Trim());
            //设置keys
            string keys = "";
            keys = BCW.User.Users.SetUserKeys(UsId, UsPwd, UsKey);
            string bUrl = string.Empty;
            if (Utils.getPage(1) != "")
            {
                bUrl = Utils.getUrl(Utils.removeUVe(Utils.getPage(1)));
            }
            else
            {
                bUrl = Utils.getUrl("/default.aspx");
            }
            //更新识别串
            string SID = ConfigHelper.GetConfigString("SID");
            bUrl = UrlOper.UpdateParam(bUrl, SID, keys);
            //写入Cookie
            if (IsMy == true)
            {
                HttpCookie cookie = new HttpCookie("LoginComment");
                cookie.Expires = DateTime.Now.AddDays(30);//30天
                cookie.Values.Add("userkeys", DESEncrypt.Encrypt(Utils.Mid(keys, 0, keys.Length - 4)));
                Response.Cookies.Add(cookie);
            }
            else
            {
                //清Cookie
                HttpCookie Cookie = new HttpCookie("LoginComment");
                Cookie.Expires = DateTime.Now.AddDays(-1);
                HttpContext.Current.Response.Cookies.Add(Cookie);
            }
            if (Request["IsMy"] == "pwd")
            {
                string   ForumSet   = new BCW.BLL.User().GetForumSet(UsId);
                string[] fs         = ForumSet.Split(",".ToCharArray());
                string   sforumsets = string.Empty;
                for (int i = 0; i < fs.Length; i++)
                {
                    string[] sfs = fs[i].ToString().Split("|".ToCharArray());

                    if (i == 25)
                    {
                        sforumsets += "," + sfs[0] + "|" + DateTime.Now;
                    }
                    else
                    {
                        sforumsets += "," + sfs[0] + "|" + sfs[1];
                    }
                }
                sforumsets = Utils.Mid(sforumsets, 1, sforumsets.Length);
                new BCW.BLL.User().UpdateForumSet(UsId, sforumsets);
            }
            //----------------------写入登录日志文件作永久保存
            try
            {
                string MyIP   = Utils.GetUsIP();
                string ipCity = string.Empty;
                if (!string.IsNullOrEmpty(MyIP))
                {
                    ipCity = new IPSearch().GetAddressWithIP(MyIP);
                    if (!string.IsNullOrEmpty(ipCity))
                    {
                        ipCity = ipCity.Replace("IANA保留地址  CZ88.NET", "本机地址").Replace("CZ88.NET", "") + ":";
                    }

                    string FilePath = System.Web.HttpContext.Current.Server.MapPath("/log/loginip/" + UsId + "_" + DESEncrypt.Encrypt(UsId.ToString(), "kubaoLogenpt") + ".log");
                    LogHelper.Write(FilePath, "" + ipCity + "" + MyIP + "(登录)");
                }
            }
            catch { }
            //----------------------写入日志文件作永久保存
            new BCW.BLL.User().UpdateTime(UsId);

            //VIP隐身
            int VipLeven = BCW.User.Users.VipLeven(UsId);
            if (new BCW.BLL.Role().IsAllMode(UsId) == false && VipLeven > 0)
            {
                new BCW.BLL.User().UpdateState(UsId, 1);
            }


            Utils.Success("登录成功", "登录成功!返回登录前的页面..<br />如果没有自动跳转,请点击以下链接..", Out.SysUBB(bUrl), "2");
        }
        else
        {
            Utils.Error("登录失败,会员ID/手机号码或密码错误", "");
        }
    }