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
}
查看全文
相关阅读:
升级linux bash
vim关键字自动补全
linux bash shell之变量替换::=句法、=句法、:句法、句法、=?句法、?句法、:+句法、+句法
使用Bash编写Linux Shell脚本7.复合命令
使用Bash编写Linux Shell脚本5.变量
使用Bash编写Linux Shell脚本8.调试和版本控制
Perl之单引号\双引号的字符串直接量
linux bash shell 中的单引号和双引号
使用Bash编写Linux Shell脚本6.表达式
Vim的行号、语法显示等设置,即.vimrc文件的配置
原文地址:https://www.cnblogs.com/Zoya/p/1553498.html
最新文章
各种波形文件vcd,vpd,shm,fsdb生成的方法(zz)
如何kill杀掉linux系统中的僵尸defunct进程
perl中的文件句柄
Timing Violation处理脚本(Tclsh) (zz)
firefox流氓垃圾插mysearchresult的删除
IC设计流程(zz)
Centos安装gvim
linux环境下,使用IUS9.2(也就是ncsimulator)产生fsdb波形文件的完整方法(原创)
明明还有很大空间,但是却提示:“目标驱动器中的磁盘已满”的解决方法
另一个SqlParameterCollection 中已包含 SqlParameter[解决方案]
热门文章
Lucene.net 项目停了(转)
Reflector插件下载
生成、重新生成、清理
使用GDI+进行绘图(转)
类型安全、线程安全
关于继承时内存分配的理解
bin目录和obj目录
控件的Invoke()、BeginInvoke()与委托的Invoke()、BeginInvoke()
耦合度(Coupling)
进程上下文切换 – 残酷的性能杀手(上)
Copyright © 2011-2022 走看看