学做网站培训课程介绍

当前位置:

代码实现网站防复制,防采集

自己建好了网站,但是如果不做处理,自己网站上的内容很容易被别人复制到其它网站上,对于自己网站的SEO优化不利。

更有甚者,很多人采用采集软件疯狂的采集我们网站内容,不但窃取了我们网站的内容,而且还严重增加了网站服务器的负担。为了解决这个问题,学做网站论坛讲过网站如何做防盗链设置

网站如何防复制,防采集

今天我们来讲一下如何防止别人去复制,采集自己网站的内容,方法很简单,只需要复制以下的代码放在模板文件顶部即可。

一,防复制粘贴:

<% '作用:文字防复制乱码 函数
'Date:2006-3-6
'作者:https://www.xuewangzhan.net/
'参数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
%>

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

在线
客服
手机二维码 手机二维码
返回顶部 返回顶部

温馨提示

为防止临时会话收不到QQ信息,请加QQ好友咨询
论坛客服李欣蓉QQ:2289556365

或者使用微信扫码咨询

x

温馨提示

为防止临时会话收不到QQ信息,请加QQ好友咨询
论坛客服孙丽QQ:2399118408

或者使用微信扫码咨询

x

温馨提示

为防止临时会话收不到QQ信息,请加QQ好友咨询
论坛客服刘淼淼QQ:1135082670

或者使用微信扫码咨询

x

温馨提示

为防止临时会话收不到QQ信息,请加QQ好友咨询
论坛讲师张启亚QQ:2357852508

或者使用微信扫码咨询

x

温馨提示

为防止临时会话收不到QQ信息,请加QQ好友咨询
论坛讲师方重华QQ:1730401718

或者使用微信扫码咨询

x

温馨提示

为防止临时会话收不到QQ信息,请加QQ好友咨询
论坛讲师唐超QQ:909722045

或者使用微信扫码咨询

x

温馨提示

为防止临时会话收不到QQ信息,请加QQ好友咨询
论坛讲师赵鹏QQ:614862774

或者使用微信扫码咨询

x

微信咨询

可使用微信扫下方二维码加好友咨询。

x