会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
我立寒风自癫狂
问己之不悉,解己之不惑.
博客园
首页
新随笔
联系
订阅
管理
友情链接防刷PV测试代码
没做验证..貌似正确...先记录一下
Code
1
private
static
List
<
string
>
idList
=
new
List
<
string
>
();
2
private
static
List
<
DateTime
>
timeList
=
new
List
<
DateTime
>
();
3
protected
void
Page_Load(
object
sender, EventArgs e)
4
{
5
if
(
!
IsPostBack)
6
{
7
AntiSQLInjection sqli
=
new
AntiSQLInjection();
8
string
aid
=
sqli.ReplaceStr(Request.QueryString[
"
aid
"
]);
9
GetNavigationUrl count
=
new
GetNavigationUrl();
10
if
((idList
==
null
||
idList.Count
==
0
)
&&
(timeList
==
null
||
timeList.Count
==
0
))
11
{
12
idList
=
new
List
<
string
>
();
13
timeList
=
new
List
<
DateTime
>
();
14
idList.Add(aid);
15
timeList.Add(DateTime.Now);
16
count.UrlStat(aid,
true
);
//
进来的PV统计
17
}
18
else
19
{
20
if
(idList.Count
!=
timeList.Count)
21
{
22
idList
=
new
List
<
string
>
();
23
timeList
=
new
List
<
DateTime
>
();
24
idList.Add(aid);
25
timeList.Add(DateTime.Now);
26
count.UrlStat(aid,
true
);
//
进来的PV统计
27
}
28
else
29
{
30
if
(idList.IndexOf(aid)
<
0
)
//
第一次点击
31
{
32
idList.Add(aid);
33
timeList.Add(DateTime.Now);
34
count.UrlStat(aid,
true
);
//
进来的PV统计
35
}
36
else
37
{
38
int
index
=
idList.IndexOf(aid);
39
DateTime oldTime
=
timeList[index];
40
if
(oldTime.AddMinutes(
1
)
<=
DateTime.Now)
//
超时
41
{
42
timeList[index]
=
DateTime.Now;
43
count.UrlStat(aid,
true
);
//
进来的PV统计
44
}
//
1分钟内不算进统计
45
}
46
}
47
}
48
Response.Redirect(
"
XXX
"
);
49
}
50
}
51
}
posted @
2009-08-25 11:32
Zoya Qiu
阅读(
228
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告