userlist.asp
来自「苹果风格的论坛 asp编写」· ASP 代码 · 共 110 行
ASP
110 行
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<HTML>
<HEAD>
<TITLE>用户列表 - <%= boardtitle %></TITLE>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type="text/css">
<!--
a { font-family: "Tahoma", "Verdana"; font-size: 12px; color: #333333}
body { font-family: "Tahoma", "Verdana"; font-size: 12px; color: #333333}
td { font-family: "Tahoma", "Verdana"; font-size: 12px; color: #333333; word-wrap: break-word}
-->
</STYLE>
</HEAD>
<BODY background="style/apple/image/bg.gif" text="#000000" leftmargin="0" topmargin="20">
<center>
<form method="post" action="userlist.asp" name="post">
<select name="mode">
<option value="">---选择查看方式---</option>
<option value="posts">以发帖量排序</option>
<option value="rating">以积分排序</option>
<option value="regdate">以注册日期排序</option>
</select>
<input type="submit" value="提 交">
</form>
<%
mode = "posts"
if request("mode") = "posts" then
mode = "posts"
end if
if request("mode") = "rating" then
mode = "rating"
end if
if request("mode") = "regdate" then
mode = "regdate"
end if
if mode = "posts" then response.write "当前以发帖量排序"
if mode = "rating" then response.write "当前以积分排序"
if mode = "regdate" then response.write "当前以注册日期排序"
response.write "<BR><BR>"
page = request("page")
if page = "" then
page = 1
else
if not IsNumeric(page) then
page = 1
else
page = clng(page)
end if
end if
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open StrConn
Set rs = Server.CreateObject("ADODB.Recordset")
strsql = "select userid, username, posts, country, joindate, lastposttitle, lastpostid, rating, lastposttime from sf_user"
if mode = "regdate" then strsql = strsql & " order by userid DESC"
if mode = "rating" then strsql = strsql & " order by rating DESC"
if mode = "posts" then strsql = strsql & " order by posts DESC"
rs.Open strsql, Conn, 1, 1
if not (rs.bof or rs.eof) then
i = 1
rs.PageSize = 30
if page > rs.PageCount then page = rs.PageCount
rs.AbsolutePage = page
pagecount = rs.PageCount
StrHtml = "<table width=""98%"" border=""0"" cellspacing=""1"" cellpadding=""4"" align=""center"">"
StrHtml = StrHtml & "<tr bgcolor=""#6A813A""><td width=""20%"" align=""center""><font color=""#ECECDF"">用户</font></td><td width=""10%"" align=""center""><font color=""#ECECDF"">发帖数</font></td><td width=""10%"" align=""center""><font color=""#ECECDF"">积分</font></td><td width=""20%"" align=""center""><font color=""#ECECDF"">来自</fotn></td><td width=""15%"" align=""center""><font color=""#ECECDF"">注册日期</fotn></td><td width=""25%"" align=""center""><font color=""#ECECDF"">最后发表</font></td></tr>"
do until rs.eof or i > rs.PageSize
if (i mod 2) = 0 then
StrHtml = StrHtml & "<tr bgcolor=""#FFFFFF"">"
else
StrHtml = StrHtml & "<tr bgcolor=""#F5F5F5"">"
end if
StrHtml = StrHtml & "<td><a href=""../showuser.asp?userid=" & rs("userid") & """ target=_blank>" & rs("username") & "</a></td>"
StrHtml = StrHtml & "<td align=""center"">" & rs("posts") & "</td>"
StrHtml = StrHtml & "<td align=""center"">" & rs("rating") & "</td>"
StrHtml = StrHtml & "<td>" & rs("country") & "</td>"
StrHtml = StrHtml & "<td>" & rs("joindate") & "</td>"
if rs("lastposttitle") = "" then
StrHtml = StrHtml & "<td></td>"
else
StrHtml = StrHtml & "<td><a href=""../showthread.asp?threadid=" & rs("lastpostid") & """ target=_blank>" & rs("lastposttitle") & "</a><br>" & rs("lastposttime") & "</td>"
end if
StrHtml = StrHtml & "</tr>"
i = i + 1
rs.MoveNext
loop
StrHtml = StrHtml & "</table><br><br>"
response.write StrHtml & "论坛当前共"& rs.RecordCount & "名注册用户, 当前为第" & page & "页<BR>选择页数:"
Set Conn = nothing
Set rs = nothing
for i=1 to pagecount
if i = page then
response.write " <b>" & i & "</b>"
else
response.write " <a href=""userlist.asp?mode=" & mode & "&page=" & i & """>" & i & "</a>"
end if
next
else
response.write "无注册用户"
end if
%>
<br><br><b>userlist v1.03</b> for SF2
</center>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?