日期:2014-05-18 浏览次数:20500 次
cookies = Request.Cookies["UserCookies"];//记录访客 sqls.Fill_DT("select uid from dbo.bbs_users where itemno='" + SQLUtil.FilerSql(space) + "'", dt); if(dt.Rows.Count>0)//根据博客编号去除用户。判断是是否本人访问进行排除 { if (cookies != null) { string userID = cookies["User_Uid"].ToString(); if(userID!=dt.Rows[0]["uid"].ToString())//两个用户ID不相等的话则记录为访客 { DataTable dtcaller = new DataTable(); //如果访客人数大于15则进行update最早那个访客 sqls.Fill_DT("select * from dbo.space_MyCaller",dtcaller); if (dtcaller.Rows.Count > 15) { DataTable dtid = new DataTable(); //获取15条数据最早的一条ID并进行update sqls.Fill_DT("select callerid from dbo.space_MyCaller where callerid=(select top 1 callerid from space_mycaller)",dtid); if(dtid.Rows.Count>0) { sqlt.Operate("update dbo.space_MyCaller set datetime='" + DateTime.Now.ToString() + "',uid='" + userID + "',logitemno='" + space + "' where callerid='"+dtid.Rows[0]["callerid"].ToString()+"'"); sqlt.ConClose(); } sqls.ConClose(); } else { sqlt.Operate("insert into dbo.space_MyCaller(datetime,uid,logitemno) values('" + DateTime.Now.ToString() + "','" + userID + "','" + space + "')"); sqlt.ConClose(); } } } } sqls.ConClose();