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

📄 log.asp

📁 实现系统登陆功能和系统登陆日志管理功能。适合初学者。
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file=adm_islogin.asp-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {font-size: 18px; }
.STYLE4 {font-size: small}
-->
</style>
<%
function isInteger(para)
       on error resume next
       dim str
       dim l,i
       if isNUll(para) then 
          isInteger=false
          exit function
       end if
       str=cstr(para)
       if trim(str)="" then
          isInteger=false
          exit function
       end if
       l=len(str)
       for i=1 to l
           if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
              isInteger=false 
              exit function
           end if
       next
       isInteger=true
       if err.number<>0 then err.clear
end function
function JoinChar(strUrl)
	if strUrl="" then
		JoinChar=""
		exit function
	end if
	if InStr(strUrl,"?")<len(strUrl) then 
		if InStr(strUrl,"?")>1 then
			if InStr(strUrl,"&")<len(strUrl) then 
				JoinChar=strUrl & "&"
			else
				JoinChar=strUrl
			end if
		else
			JoinChar=strUrl & "?"
		end if
	else
		JoinChar=strUrl
	end if
end function 
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit,CurrentPage)
	dim n,i,strTemp,strUrl
	if totalnumber mod maxperpage=0 then
    	n= totalnumber \ maxperpage
  	else
    	n= totalnumber \ maxperpage+1
  	end if
  	strTemp= "<table align=right border=0 cellpadding=0 cellspacing=1 bordercolor=#B4C6DB valign=middle><tr><td>"
	strTemp=strTemp & "<strong><font color=red>" & CurrentPage & "</font>/" & n & "</strong>页&nbsp;"
    strTemp=strTemp & "<b>" & maxperpage & "</b>" & strUnit & "/页&nbsp;"
	if ShowTotal=true then 
		strTemp=strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "&nbsp;"
	end if
	strUrl=JoinChar(sfilename)
  	if CurrentPage<2 then
    		strTemp=strTemp & "首页 上一页&nbsp;"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=1'>首页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage-1) & "'>上一页</a>&nbsp;"
  	end if
  	if n-currentpage<1 then
    		strTemp=strTemp & "下一页 尾页"
  	else
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & (CurrentPage+1) & "'>下一页</a>&nbsp;"
    		strTemp=strTemp & "<a href='" & strUrl & "page=" & n & "'>尾页</a>"
  	end if
   	if ShowAllPages=True then
		strTemp=strTemp & "&nbsp;转到:<select class='input' name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"   
    	for i = 1 to n   
    		strTemp=strTemp & "<option value='" & i & "'"
			if cint(CurrentPage)=cint(i) then strTemp=strTemp & " selected "
			strTemp=strTemp & ">第" & i & "页</option>"   
	    next
		strTemp=strTemp & "</select>"
	end if
	strTemp=strTemp & "</td></tr></table>"
	response.write strTemp
end sub
%>
</head>

<body>
<table width="488" height="103" border="0" align="center">
  <tr>
    <td colspan="4"><div align="center">
      <h1>登陆日志</h1>
    </div></td>
  </tr>
  <tr>
    <td width="63"><h1 class="STYLE3">用户名</h1></td>
    <td width="85"><h1 class="STYLE3">真实姓名</h1></td>
    <td width="200"><h1 align="center" class="STYLE3">登陆时间</h1></td>
    <td width="122"><h1 class="STYLE3">上次登陆的IP</h1></td>
  </tr>
  <%
	  	dim totalpage,totalrecords,currentpage,i,maxperpage,id,strfile
		currentpage=request.QueryString("page")
		if not isinteger(currentpage) then
		  currentpage=1
		else
		  currentpage=clng(currentpage)
		end if
		maxperpage=10
		totalrecords=0
		totalpage=1
		i=1
		strfile="log.asp"
		set rs=server.createobject("adodb.recordset")
		sql="select * from log order by time"
		rs.open sql,conn,1,1
		if rs.eof or rs.bof then
			response.Write"<tr><td colspan=7 align=center>没有相应的记录</td></tr>"
		end if
		rs.pagesize=maxperpage
		rs.absolutepage=currentpage
		totalpage=rs.pagecount
		totalrecords=rs.recordcount
		id=rs("id")
		do until rs.eof or i>maxperpage
		i=i+1
	  %>
  <tr>
    <td align="center"><h1 class="STYLE4"><%=rs("username")%></h1></td>
    <td><h1 class="STYLE4"><%=rs("realname")%></h1></td>
    <td><h1 class="STYLE4"><%=rs("time")%></h1></td>
    <td><h1 class="STYLE4"><%=rs("ip")%></h1></td>
  </tr>
  <%
	  	rs.movenext
		loop
	  %>
      <tr class="b">
        <td colspan="8" align="right"><h1 class="STYLE4"><%if totalrecords>0 then call showpage(strfile,totalrecords,maxperpage,true,true,"个",CurrentPage) end if%></h1></td>
      </tr>
</table>
<%
rs.close
set rs=nothing


%>
</body>
</html>

⌨️ 快捷键说明

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