<!-- #include file="tjConn.asp" -->
<!-- #include file="Conn.asp" -->
<!-- #include file="admin.asp" -->
<%
Dim Conntjj,sid,ip
sid=Request.querystring("sid")
ip2=request.querystring("ip")
On Error Resume Next
set Conntjj=Server.CreateObject ("Adodb.Connection")
Conntjj.Open "provider=microsoft.jet.oledb.4.0;" & "data source = " & server.mappath(""&db&"")
Call head()
Call saycarda("统计明细管理")
dim rs,sql,page,i,listid
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1

    		listid = Request("listid")      '当前页数
    		If listid = "" Then listid = 1
   		If Not IsNumeric(listid) Then listid = 1
    		listid = CLng(listid)
    		If listid < 1 Then listid = 1
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql = "select * from qtwap_tj_list where ip like " & sqlstr(ip2) &"  order by id desc"
Rs.Open Sql,Conntjj,1,1
if not (rs.bof and rs.eof)  then

				Rs.PageSize = 10	'一页N条记录
				IF Not IsEmpty(Page) Then
					IF Not IsNumeric(Page) Then		'判断Page是否为数字
						Page=1
					Else
						Page=Cint(Page)		'转换成短整形Integer
					End IF
					IF Page > Rs.PageCount Then
						Rs.AbsolutePage = Rs.PageCount	'设置当前显示页等于最后一页
					ElseIF Page <= 0 Then
						Rs.AbsolutePage = 1		'设置当前页等于第一页
					Else
						Rs.AbsolutePage = Page	'如果大于零,显示当前页等于接收的页数
					End IF
				Else
					Rs.AbsolutePage = 1
				End IF
				Page = Rs.AbsolutePage


		For i=1 to  Rs.PageSize
		If Rs.Eof Then
			exit For
		End If
			%><%=i+(page-1)*Rs.PageSize%>:<%=rs("time")%><br/>
			总访问:<%=rs("count")%>,IP访问<%=rs("ip")%><br/>
			来源地址:<%=showip(rs("ip"))%><br/>
			[<a href="admin_del_tj_list.asp?id=<%=rs("id")%>&amp;saytk=<%=saytk%>&amp;sid=<%=sid%>">删除</a>]<br/><%
	 	Rs.MoveNext
	  	Next

       
    		'分页
    		If Page < rs.PageCount Then
    		    Response.Write("<a href='admin_tj_list.asp?listid=" & listid & "&amp;page=" & Page + 1 & "&amp;sid=" & sid & "'>下一页</a>")
    		End If
       
    		If Page > 1 And Page < rs.PageCount Then
    		    Response.Write("|")
    		End If
        
    		If Page > 1 Then
    		    Response.Write("<a href='admin_tj_list.asp?listid=" & listid & "&amp;page=" & Page - 1 & "&amp;sid=" & sid & "'>上一页</a><br/>")
    		Elseif rs.PageCount >1 then
    		    Response.Write("<br/>")
    		End If
            
    		Randomize()
    
    		If rs.PageCount > 2 Then
    		    Response.Write("<input name='Page' format='*N' size='5' maxlength='5'/>")
    		    Response.Write("<anchor>跳页")
    		    Response.Write("<go href='admin_tj_list.asp?listid=" & listid & "&amp;run=" & Int((9999) * Rnd() + 1) & "&amp;sid=" & sid & "' method='post'>")
    		    Response.Write("<postfield name='Page' value='$(Page:n)' />")
    		    Response.Write("</go></anchor><br/>")
    		End If
     		    Response.Write("[第"&Page&"/总"&rs.PageCount&"页/"&rs.RecordCount&"条]<br/>")

		end if
		Rs.close

			
	set rs=nothing

   		Response.Write("<anchor title=""back""><prev/>返回上级页面</anchor><br/><a href='admin_tj.asp?sid=" & sid & "'>返回统计首页</a><br/>")
   		Response.Write("<a href='index.asp?sid=" & sid & "'>后台管理首页</a><br/>")
Call headsay()

On Error Resume Next
Server.ScriptTimeOut=9999999
function getHTTPPage(url,Input_) 
dim Http 
set Http=server.createobject("Microsoft.XMLHTTP") 
Http.Open "POST",url,False,"", ""
Http.SetRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
Http.Send(Input_) 
if Http.readystate<>4 then 
exit function 
end if 
getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8") 'utf-8,GB2312
set http=nothing 
if err.number<>0 then err.Clear 
end function
 
Function BytesToBstr(body,Cset) 
dim objstream 
set objstream = Server.CreateObject("adodb.stream") 
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 

Function showip(ip)
if ip<>"" then
Dim Url,start,over,body,wstr,str,Input_
Url="http://wap.ip138.com/ip.asp"
Input_="ip="& ip &""
wstr=getHTTPPage(url,Input_) 
start=Instr(wstr,"<p>")+3
over=Instr(wstr,"(c)2003-06 wap.ip138.com<br/>")
body=mid(wstr,start,over-start)
body=replace(body,""&ip&"","")
body=replace(body,"<b>","")
body=replace(body,"</b>","")
body=replace(body,"<br/>","")
body=replace(body,"查询结果：","")
		showip=body
	else
		showip="找不到该IP地址"
	rs.Close
	Set rs = Nothing

	Set ConntjjIP = Nothing

end if
End Function
function sqlstr(data)
	sqlstr="'" & Replace(data,"'","'") & "'"
end function
%>