userlist.asp

来自「小游戏网站演示www.4399.io 拥有4万条游戏数据」· ASP 代码 · 共 165 行

ASP
165
字号
<!--#include file="config.asp"-->
<!--#include file="../inc/classmenu.asp"-->
<%
dim htmlcontent,templistcontent,channelrootdir
dim userid,username
userid = newasp.chknumeric(request("userid"))
username = newasp.checkstr(request("name"))
username = newasp.checkbadstr(username)
channelrootdir = newasp.installdir & "user/"
newasp.loadtemplates 9999, 5, 0

htmlcontent = newasp.htmlcontent
htmlcontent = replace(htmlcontent,"{$installdir}", newasp.installdir)
htmlcontent = replace(htmlcontent, "{$channelid}", 0)
'--频道目录
htmlcontent = replace(htmlcontent,"{$channelrootdir}", channelrootdir)
htmlcontent = readclassmenu(htmlcontent)
htmlcontent = readclassmenubar(htmlcontent)

if userid = 0 and len(username) = 0 then
	call showuserlist
else
	call showuserinfo
end if

if founderr = true then
	call returnerr(errmsg)
end if
closeconn
public sub showuserlist()
	dim rs,sql,i,j,forbid
	dim maxperpage,currentpage,pcount,totalrec,totalnumber
	dim strlist,strname,rowcode,strcontent,strusername
	dim strhomepage,strusermail,strshowpage
	
	forbid = newasp.chknumeric(newasp.htmlsetting(17))
	if forbid = 2 then
		errmsg = newasp.htmlsetting(18)
		founderr = true
		exit sub
	end if
	if forbid = 1 then
		if cint(newasp.membergrade) = 0 then
			errmsg = newasp.htmlsetting(19)
			founderr = true
			exit sub
		end if
	end if
	maxperpage = newasp.chknumeric(newasp.htmlsetting(11))
	if maxperpage = 0 then maxperpage = 20
	currentpage = newasp.chknumeric(request("page"))
	if currentpage = 0 then currentpage = 1
	'if not isobject(conn) then connectiondatabase
	sql = "select userid,username,nickname,usergrade,usergroup,userclass,userlock,userpoint,usermoney,truename,usersex,usermail,homepage,oicq,jointime,expiretime,lasttime,userlogin from [nc_user] order by jointime desc ,userid desc"
	set rs = server.createobject("adodb.recordset")
	rs.open sql,conn,1,1
	if not (rs.bof and rs.eof) then
		totalrec = rs.recordcount
		pcount = clng(totalrec / maxperpage)  '得到总页数
		if pcount < totalrec / maxperpage then pcount = pcount + 1
		if currentpage < 1 then currentpage = 1
		if currentpage > pcount then currentpage = pcount
		rs.pagesize = maxperpage
		rs.absolutepage = currentpage
		i = 0
		j = (currentpage - 1) * maxperpage + 1
		do while not rs.eof and i < maxperpage
			if not response.isclientconnected then responseend
			if (i mod 2) = 0 then
				rowcode = 1
			else
				rowcode = 2
			end if
			strcontent = strcontent & newasp.htmlsetting(13)
			strusername = "<a href=""?userid=" & rs("userid") & """>" & rs("username") & "</a>"
			strcontent = replace(strcontent, "{$username}", strusername)
			strcontent = replace(strcontent, "{$userid}", rs("userid"))
			strcontent = replace(strcontent, "{$userlogin}", rs("userlogin"))
			strcontent = replace(strcontent, "{$userpoint}", rs("userpoint"))
			strcontent = replace(strcontent, "{$usersex}", rs("usersex"))
			strcontent = replace(strcontent, "{$userqq}", rs("oicq"))
			strcontent = replace(strcontent, "{$lasttime}", rs("lasttime"))
			strcontent = replace(strcontent, "{$dateandtime}", rs("jointime"))
			strcontent = replace(strcontent, "{$orderid}", j)
			strusermail = "<a href=""mailto:" & rs("usermail") & """ target=""_blank"" title=""给此用户发送邮件"">电子信箱</a>"
			strcontent = replace(strcontent, "{$usermail}", strusermail)
			strcontent = replace(strcontent, "{$usergroup}", rs("usergroup"))
			if newasp.checknull(rs("homepage")) then
				strhomepage = "<a href=""" & rs("homepage") & """ target=""_blank"" title=""点击查看用户主页"">用户主页</a>"
				strcontent = replace(strcontent, "{$homepage}", strhomepage)
			else
				strcontent = replace(strcontent, "{$homepage}", "没有主页")
			end if
			rs.movenext
			i = i + 1
			j = j + 1
			if i >= maxperpage then exit do
		loop
	end if
	rs.close:set rs = nothing
	strshowpage = showpages(currentpage,pcount,totalrec,maxperpage,"")
	templistcontent = newasp.htmlsetting(12) & strcontent & newasp.htmlsetting(14)
	htmlcontent = replace(htmlcontent,"{$usermanagecontent}", templistcontent)
	htmlcontent = replace(htmlcontent, "{$readlistpage}", strshowpage)
	htmlcontent = replace(htmlcontent,"{$pagetitle}",newasp.htmlsetting(10))
	response.write htmlcontent
end sub

sub showuserinfo()
	if userid = 0 and len(username) = 0 then exit sub
	dim rs,sql,forbid,sendurl
	dim strcontent,strhomepage,strusermail
	
	forbid = newasp.chknumeric(newasp.htmlsetting(17))
	if forbid = 2 then
		errmsg = newasp.htmlsetting(18)
		founderr = true
		exit sub
	end if
	if forbid = 1 then
		if cint(newasp.membergrade) = 0 then
			errmsg = newasp.htmlsetting(19)
			founderr = true
			exit sub
		end if
	end if
	
	if userid = 0 then
		sql = "select userid,username,nickname,usergrade,usergroup,userclass,userlock,userpoint,usermoney,truename,usersex,usermail,homepage,oicq,jointime,expiretime,lasttime,userlogin from [nc_user] where username='" & username &"'"
	else
		sql = "select userid,username,nickname,usergrade,usergroup,userclass,userlock,userpoint,usermoney,truename,usersex,usermail,homepage,oicq,jointime,expiretime,lasttime,userlogin from [nc_user] where userid=" & userid
	end if
	set rs = newasp.execute(sql)
	strcontent = ""
	if not (rs.bof and rs.eof) then
		sendurl = "message.asp?action=new&amp;touser="& rs("username")
		strcontent = newasp.htmlsetting(16)
		strcontent = replace(strcontent, "{$username}", rs("username"))
		strcontent = replace(strcontent, "{$username}", "<a href=""" & sendurl & """ target=""_blank"">" & rs("username") & "</a>")
		strcontent = replace(strcontent, "{$userid}", rs("userid"))
		strcontent = replace(strcontent, "{$usergroup}", rs("usergroup"))
		strcontent = replace(strcontent, "{$userlogin}", rs("userlogin"))
		strcontent = replace(strcontent, "{$userpoint}", rs("userpoint"))
		strcontent = replace(strcontent, "{$usersex}", rs("usersex"))
		strcontent = replace(strcontent, "{$sendurl}", sendurl)
		strcontent = replace(strcontent, "{$sendmessage}", "<a href=""" & sendurl & """ target=""_blank"">发送短消息</a>")
		strcontent = replace(strcontent, "{$userqq}", newasp.chknull(rs("oicq")))
		strcontent = replace(strcontent, "{$lasttime}", rs("lasttime"))
		strcontent = replace(strcontent, "{$dateandtime}", rs("jointime"))
		strusermail = "<a href=""mailto:" & rs("usermail") & """ target=""_blank"" title=""给此用户发送邮件"">" & rs("usermail") & "</a>"
		strcontent = replace(strcontent, "{$usermail}", strusermail)
		if newasp.checknull(rs("homepage")) then
			strhomepage = "<a href=""" & rs("homepage") & """ target=""_blank"" title=""点击查看用户主页"">" & rs("homepage") & "</a>"
			strcontent = replace(strcontent, "{$homepage}", strhomepage)
		else
			strcontent = replace(strcontent, "{$homepage}", "没有主页")
		end if
	end if
	rs.close:set rs = nothing
	htmlcontent = replace(htmlcontent,"{$usermanagecontent}", strcontent)
	htmlcontent = replace(htmlcontent,"{$pagetitle}",newasp.htmlsetting(15))
	response.write htmlcontent
end sub

%>

⌨️ 快捷键说明

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