<% @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
%>