zoukankan
html css js c++ java
友情链接防刷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
}
查看全文
相关阅读:
centos7下部署iptables环境纪录(关闭默认的firewalle)
JVM性能调优2:JVM性能调优参数整理
增加swap分区,文件形式
常用nginx rewrite重定向-跳转实例:
nginx反向代理解决跨域
Python,Jupyter Notebook,IPython快速安装教程
Python之NumPy实践之数组和矢量计算
Python之IPython开发实践
技术应用涉及到的四个方面的问题
Python Base of Scientific Stack(Python基础之科学栈)
原文地址:https://www.cnblogs.com/Zoya/p/1553498.html
最新文章
java-索引
什么是Java序列化,如何实现java序列化
Java序列化机制原理
JAVA不可变类(immutable)机制与String的不可变性
理解Java中的引用传递和值传递
Pig 在 shell script中被调用,批量载入处理文件
CodeForces 653 A. Bear and Three Balls——(IndiaHacks 2016
Cocos2d-x飞机大战教程笔记
EarthWarrior3D游戏ios源代码
DM8168 IPNC Boa移植
热门文章
[Linux]在终端启动程序关闭终端不退出的方法
Apache日志优化
CF 557A(Ilya and Diplomas-贪心)
一段代码完毕全部分享功能,分分钟搞定分享功能
使用jQuery.makeArray() 将多种类型转换成JS原生Array
diff目录或文件比较
SVN与TortoiseSVN实战:TortoiseSVN新建及合并分支
CentOS6.7下Ansible部署
Jenkins插件获取git分支的方法
iptables限制同一IP连接数,防防CC/DDOS攻击
Copyright © 2011-2022 走看看