ASP collection prevention code

Source: Internet
Author: User

I. Anti-copy and paste:
<% 'Role: Text anti-copy garbled Function
'Date: 2006-3-6
'Author: blue2004
'The STR parameter is the original text, and the str1 author is yourself. reslut generates garbled seeds.
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) 'to generate a random number.
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) 'to generate a random number.
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 '> [the copyright belongs to the original author and" & str1, reprinted, please specify the source] </div>"
End Function

Dim
A = "Hey, A <br> good news <p> Article </P> <br> <p> I agree, All rights reserved. </P>"

'Only for test
Response. Write ()

Dim B
'For the combined conversion, the size of string a is replaced with lower case
B = readtocode (lcase (a), "blue2004", "www.net.cn ")

'Output
Response. Write B
%>
Ii. Anti-collection
Prevents website content from being stolen and collected ASP code

<%
Dim appealnum, appealcount
Appealnum = 10' the same ip60 s request limit is 10 times
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 "It is very tiring to capture. Please wait for a while! "
Response. End
End if
%>
Anti-collection is required sooner or later. Keep this field for use now. Very practical

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.