A new method of anti-collection of ASP dynamic pages

Source: Internet
Author: User
Tags servervariables

<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%
Response.Write (Server.HTMLEncode (Gethttppage ("http://localhost/Index.asp tutorial", "GB2312"))
==============================
Function Name: gethttppage
Function: Get page source code function
Parameters: URL Httpurl
==============================
Function Gethttppage (Httpurl,code)
If IsNull (httpurl) =true Or httpurl= "" Then
Gethttppage= "A site maintenance!" "
Exit Function
End If
On Error Resume Next
Dim Http
Set http=server.createobject ("MSX" & "ML2.") XML "&" HTTP ")
Http.open "Get", Httpurl,false
Http.send ()
If Http.readystate<>4 Then
Set http=nothing
Gethttppage= "b Site maintenance! "
Exit function
End If
Gethttppage=bytestobstr (Http.responsebody,code)
Set http=nothing
If Err.number<>0 Then
Err.Clear
Gethttppage= "C Site maintenance! "
Exit function
End If
End Function
==============================
Function Name: BYTESTOBSTR
function: Converting coded functions
Parameters: String body, encoding Cset
==============================
Function Bytestobstr (Body,cset)
Dim objstream
Set objstream = Server.CreateObject ("ADO" & "D" & "B.st" & "Re" & "AM")
objStream.Type = 1
Objstream.mode =3
objStream.Open
Objstream.write body
objstream.position = 0
objStream.Type = 2
Objstream.charset = Cset
Bytestobstr = Objstream.readtext
objStream.Close
Set objstream = Nothing
End Function
%>
<%
Dim Conn,rs,sqlstr,ip
Set Conn = Server.CreateObject ("Adodb.connection")
Set rs=server.createobject ("Adodb.recordset")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ("Data.mdb")
Conn.Open ConnStr
Ip=request.servervariables ("REMOTE_ADDR")
Sqlstr= "SELECT * from [IP2]"
Rs.Open sqlstr,conn,1,3
Application.Lock ()
Rs.addnew ()
Rs ("ip2_address") =ip
Rs.update ()
Application.UnLock ()
Rs.close
%>
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%
Dim Conn,rs,sqlstr,ip,iptime,iptime2,newuser
Newuser=0
Set Conn = Server.CreateObject ("Adodb.connection")
Set rs=server.createobject ("Adodb.recordset")
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" & Server.MapPath ("Data.mdb")
Conn.Open ConnStr
Ip=request.servervariables ("REMOTE_ADDR")
Sqlstr= "SELECT * from [IP1] Where ip1_address= '" &Ip& "' ORDER by ip1_id Desc"
Rs.Open sqlstr,conn,1,3
If rs.eof Then
Newuser=1
Application.Lock ()
Rs.addnew ()
Rs ("ip1_address") =ip
Rs.update ()
Application.UnLock ()
Else
Iptime=rs ("Ip1_time")
Application.Lock ()
Rs.addnew ()
Rs ("ip1_address") =ip
Rs.update ()
Application.UnLock ()
End If
Rs.close
If newuser=0 Then
Sqlstr= "SELECT * from [IP2] Where ip2_address= '" &Ip& "' ORDER by ip2_id Desc"
Rs.Open sqlstr,conn,1,3
If rs.eof Then
Rs.close
Response.Write ("Do not collect!") ")
Response.End ()
Else
Iptime2=rs ("Ip2_time")
If DateDiff ("s", Iptime2,iptime) >10 Then
Rs.close
Response.Write ("http://www.3lian.com/tutorial prompts you, please collect!") ")
Response.End ()
End If
End If
Rs.close
End If
%>

Related Article

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.