网站计数器

View Code
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Com.Netmarch.BLL;
using Com.Netmarch.Model;

/// <summary>
/// 网站计数器
/// </summary>
public class VisitCounter
{
    [Ajax.AjaxMethod]
    public static void UpdateVisitRecord(int tongji_Id, string tongji_ReferUrl, string tongji_ReferEngine, string tongji_ClientScreen, string tongji_ClientSystem, string tongji_ClientBrowser)
    {
        VisitRecord nmm_VisitRecord = new VisitRecord();
        VisitRecordInfo oVisitRecordInfo = nmm_VisitRecord.GetVisitRecordInfoByID(tongji_Id);
        if (oVisitRecordInfo != null)
        {
            //只允许更新两分钟内的记录
            if (oVisitRecordInfo.VisitTime.AddMinutes(2) >= DateTime.Now && oVisitRecordInfo.VisitIp == HttpContext.Current.Request.UserHostAddress)
            {
                oVisitRecordInfo.ReferUrl = tongji_ReferUrl;
                oVisitRecordInfo.ReferEngine = tongji_ReferEngine;
                oVisitRecordInfo.ClientScreen = tongji_ClientScreen;
                oVisitRecordInfo.ClientSystem = tongji_ClientSystem;
                oVisitRecordInfo.ClientBrowser = tongji_ClientBrowser;
                nmm_VisitRecord.UpdateVisitRecordByID(oVisitRecordInfo);
            }
        }
    }
}

 

posted @ 2012-06-27 22:47  kiddy-star  阅读(142)  评论(0编辑  收藏  举报