⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showonline.asp

📁 较为详细的介绍了asp自定义的各种函数,方便asp的各种开发.
💻 ASP
字号:
<%
function browser(info)
    if Instr(info,"NetCaptor 6.5.0")>0 then
        browser="NetCaptor 6.5.0"
    elseif Instr(info,"MyIe 3.1")>0 then
        browser="MyIe 3.1"
    elseif Instr(info,"NetCaptor 6.5.0RC1")>0 then
        browser="NetCaptor 6.5.0RC1"
    elseif Instr(info,"NetCaptor 6.5.PB1")>0 then
        browser="NetCaptor 6.5.PB1"
    elseif Instr(info,"MSIE 5.5")>0 then
        browser="Internet Explorer 5.5"
    elseif Instr(info,"MSIE 6.0")>0 then
        browser="Internet Explorer 6.0"
    elseif Instr(info,"MSIE 6.0b")>0 then
        browser="Internet Explorer 6.0b"
    elseif Instr(info,"MSIE 5.01")>0 then
        browser="Internet Explorer 5.01"
    elseif Instr(info,"MSIE 5.0")>0 then
        browser="Internet Explorer 5.00"
    elseif Instr(info,"MSIE 4.0")>0 then
        browser="Internet Explorer 4.01"
    else
        browser="其它"
    end if
end function
function system(info)
    if Instr(info,"NT 5.1")>0 then
        system=system+"Windows XP"
    elseif Instr(info,"Tel")>0 then
        system=system+"Telport"
	elseif Instr(info,"webzip")>0 then
        system=system+"webzip"
	elseif Instr(info,"flashget")>0 then
        system=system+"flashget"
	elseif Instr(info,"offline")>0 then
        system=system+"offline"
    elseif Instr(info,"NT 5")>0 then
        system=system+"Windows 2000"
    elseif Instr(info,"NT 4")>0 then
        system=system+"Windows NT4"
    elseif Instr(info,"98")>0 then
        system=system+"Windows 98"
    elseif Instr(info,"95")>0 then
        system=system+"Windows 95"
	elseif instr(info,"unix") or instr(info,"linux") or instr(info,"SunOS") or instr(info,"BSD") then
	    system=system+"类Unix"
    elseif instr(thesoft,"Mac") then
	    system=system+"Mac"
    else
        system=system+"其它"
    end if
end function
	dim conn
	dim connstr
	dim db
	'更改数据库名字
	db="asdf7as9d15121sdfas/as3456d66fa6sdfa.asp"
	Set conn = Server.CreateObject("ADODB.Connection")
	connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
	conn.Open connstr

function CloseDatabase

	Conn.close
	Set conn = Nothing

End Function
  const MaxPerPage=45
   	dim totalPut
   	dim CurrentPage
   	dim TotalPages
   	dim i,j
   	dim sql
   	dim rs
   	if not isempty(request("page")) then
      		currentPage=cint(request("page"))
   	else
      		currentPage=1
   	end if
  set Rs=server.createobject("adodb.recordset")
%>
<HTML>
<HEAD>
<TITLE>在线用户</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
</HEAD>
<BODY text=#003300 vLink=#002200 bgColor=#cccccc leftMargin=0 topMargin=0>
<table width="770" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td colspan="7" valign="top" bgcolor="#FFFFFF" ><table width="98%" border="0" align="center">
        <tr> 
          <td><img src="images/dotdb.gif" width="10" height="10" align="absmiddle"> 
            当前位置:<a class=white_bg 
            href="/">首页</a> &gt;&gt; <a class=white_bg 
            href="./"><%= CategoryName_CHS %></a> &gt;&gt; 在线用户</td>
        </tr>
      </table>
      <table width="98%" border=0 align="center" cellpadding=1 cellspacing=1 bgcolor="#cccccc">
        <tr bgcolor="#E4E4E4"  height=25> 
          <td align="center">用户</td>
          <td align="center">访问时间</td>
          <td align="center"  nowrap>活动时间</td>
          <td align="center"  nowrap>用户IP</td>
          <td align="center"  nowrap>操作系统</td>
          <td align="center"  nowrap>浏览器</td>
        </tr>
        <tr bgcolor="#FFFFFF"> 
          <td colspan="6"> <% 
	  sql="select * from SoftDown_online order by lastimebk Desc"
       rs.open sql,conn,1,1 
  	  if rs.eof and rs.bof then 
       		response.write "<table><tr><td border=""0"" width=""100%"" height=""100%"" cellspacing=""1"" cellpadding=""0"" bgcolor=""#FFFFFF""><p align=""center"">没有或没有找到任何在线用户,</p></td></tr></table>" 
      else 
     		totalPut=rs.recordcount
      		if currentpage<1 then
          		currentpage=1
      		end if
      		if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     			currentpage= totalPut \ MaxPerPage
	  		else
	      			currentpage= totalPut \ MaxPerPage + 1
	   		end if
      		end if
       		if currentPage=1 then
           		showpage totalput,MaxPerPage,"ShowOnline.asp"
            		showContent
            		showpage totalput,MaxPerPage,"ShowOnline.asp"
       		else
          		if (currentPage-1)*MaxPerPage<totalPut then
            			rs.move  (currentPage-1)*MaxPerPage
            			dim bookmark
            			bookmark=rs.bookmark
           			showpage totalput,MaxPerPage,"ShowOnline.asp"
            			showContent
             			showpage totalput,MaxPerPage,"ShowOnline.asp"
        		else
	        		currentPage=1
           			showpage totalput,MaxPerPage,"ShowOnline.asp"
           			showContent
           			showpage totalput,MaxPerPage,"ShowOnline.asp"
	      		end if
	   	end if
   	rs.close 	
   	end if 
	         
   	sub showContent 
       	dim i 
	   	i=0 
%> </td>
        </tr>
          <% do while not rs.eof %>
          <tr bgcolor="#FFFFFF"> 
            <td align="center"><%= rs("UserName") %></td>
            <td align="center"><%= rs("startime") %></td>
            <td align="center"><%= rs("lastimebk") %></td>
            <td align="center"><%= rs("ip") %></td>
            <td align="center"><%= system(rs("browser")) %></td>
            <td align="center"><%= browser(rs("browser")) %></td>
          </tr>
          <%
	      i=i+1
	      if i>=MaxPerPage then exit do
	      rs.movenext
	    loop
	%>
        <tr bgcolor="#FFFFFF"> 
          <td colspan="6"> <%
   end sub 

	function showpage(totalnumber,maxperpage,filename)
  	dim n

  	if totalnumber mod maxperpage=0 then
     		n= totalnumber \ maxperpage
  	else
     		n= totalnumber \ maxperpage+1
  	end if
  	response.write "<table cellspacing=1 width='100%' border=0 colspan='4' ><form method=Post action="""&filename&"""><tr><td align=right> "
  	if CurrentPage<2 then
    		response.write "当前共有<strong><font color=red>"&totalnumber&"</font></strong>位用户在线&nbsp;首页 上一页&nbsp;"
  	else
    		response.write "当前共有<strong><font color=red>"&totalnumber&"</font></strong>位用户在线&nbsp;<a href="&filename&"?page=1&"">首页</a>&nbsp;"
    		response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		response.write "下一页 尾页"
  	else
    		response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
    		response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
  	end if
   	       response.write "&nbsp;页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
           response.write "&nbsp;<b>"&maxperpage&"</b>位用户/页 "
%>
            转到: 
            <select name='page' size='1' style="font-size: 9pt" onChange='javascript:submit()'>
              <%for i = 1 to n%>
              <option value='<%=i%>' <%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
              <%next%>
            </select> <%   
	response.write "</td></tr></FORM></table>"
end function
%> </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
</BODY></HTML>
<%

  set rs=nothing
CloseDatabase
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -