ASP防采集实用代码
来源:互联网 发布:java语言数字金字塔 编辑:程序博客网 时间:2024/05/21 08:47
一、防复制粘贴:
<% '作用:文字防复制乱码 函数
'Date:2006-3-6
'作者:blue2004
'参数str 为原文,str1作者也是你自己,reslut产生乱码的种子
Function ReadToCode(str,Str1,result)
dim name
dim i,j,k
If isnull(str) then
ReadToCode=""
Exit Function
End If
Randomize
k=instr(str,"</P>")
Do while k>0
result=""
for i=0 to 19
j=Int(128 * Rnd)+1
if j=60 or j=62 then
j=j+1
end if
result =result&chr(j) ' 产生随机数。
next
result="<span style='DISPLAY: none'>"&result&"</span>"
str=replace(str,"</p>",result&"<'/p>",1,1)
k=instr(str,"</p>")
loop
str=replace(str,"<'/p>","</p>")
k=instr(str,"<br>")
Do while k>0
result=""
for i=0 to 19
j=Int(128 * Rnd)+1
if j=60 or j=62 then
j=j+1
end if
result =result&chr(j) ' 产生随机数。
next
result="<span style='DISPLAY: none'>"&result&"</span>"
str=replace(str,"<br>",result&"<'br>",1,1)
k=instr(str,"<br>")
loop
str=replace(str,"<'br>","<br>")
ReadToCode=str&"<div align=right style='color=gray'>[版权归原作者及"&Str1&"共同拥有,转载请注明出处]</div>"
End Function
Dim a
a="嘿嘿,一篇<br>不错的好<p>文章哦</P><br><P>我艹,版权所有。</p>"
'Only For Test
response.write (a)
Dim b
'为配合转换,字符串a的大小都替换成小写
b=ReadToCode(LCase(a),"blue2004","www.net.cn")
'Output
response.write b
%>
二、防采集
防止网站内容被人小偷和采集的ASP代码
<%
Dim AppealNum,AppealCount
AppealNum=10 '同一IP60秒内请求限制10次
AppealCount=Request.Cookies("AppealCount")
If AppealCount="" Then
response.Cookies("AppealCount")=1
AppealCount=1
response.cookies("AppealCount").expires=dateadd("s",60,now())
Else
response.Cookies("AppealCount")=AppealCount+1
response.cookies("AppealCount").expires=dateadd("s",60,now())
End If
if int(AppealCount)>int(AppealNum) then
response.write "抓取很累,歇一会儿吧!"
response.end
End If
%>
防采集早晚要做的。现在先留着这个段子用。很实用
- ASP防采集实用代码
- 一段ASP防采集的代码
- 网站防采集代码
- asp 防注入代码
- ASP页面的防采集实现
- asp采集代码示例
- asp 采集代码
- sql防注入代码(asp)
- asp 防注入相关代码
- asp防sql注入代码
- 万能asp防注代码
- ASP通用防注入代码
- 万能Asp防注入代码
- 万能Asp防注入代码
- 采集与防采集
- ASP实用代码
- ASP实用代码 (转载)
- ASP网站数据采集的攻、防原理和策略
- 股票收益计算器
- 输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。
- mtk modis 菜单功能紊乱
- Google和百度的搜索框大小差异
- ASP通用开发规范(个人标准)
- ASP防采集实用代码
- OpenCasCade 教程-瓶子 (3)
- 在jsp中显示数据库Blob字段图片实例
- 模板参数名命名惯例
- LINQ to SQL语句之Insert/Update/Delete操作学习笔记
- 一个verilog问题,无解!
- 创建型模式总结
- C# 2.0宝典
- C#与 Flash 程序开发