<!--#include file="setup.asp"-->
<!--#include file="plus/Ex_Stock/Exsm_Plus_Conn.asp"-->
<!--#include file="plus/Ex_Stock/Exsm_Plus_Const.asp"-->
<%
if request("action")="Reflash" then
	call Reflash()
else
	call main()
end if
sub main()
	Dim sqluser,Title,username
	If request("action")="search" then
		username=trim(replace(request("username"),"'",""))
		If username="" then
			Exsm.Errmess="<li>请输入查找关键字。"
			Call Exsm.Endinfo(1)
			exit sub
		End if
			sqluser= "select * from Ex_User where UserName='"&username&"'"
			Set Rs=stock_conn.execute(sqluser)
		Title="查找结果"
	Else
		If request("paixu")="资产" then
			sqluser= "select * from Ex_User order by UserWealth desc"
			Title="-=> 资 产 排 行 <=-"
		Else
			Title="-=> 总 资 产 排 行 <=-"
			sqluser= "select * from Ex_User order by UserAssets desc"
		End if
	End if
	Exsm.Title 1,"详细排名"
	Dim ExRs,UserId,RankSecret,page
	page=request("page")
	If page="" Or Not isnumeric(page) Then page=1
	Response.Write "<script language=""JavaScript"" src =""plus/Ex_Stock/Exsm_Plus_TopUser.js""></script>"
	Response.Write "<Script Language=JavaScript>"
	Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
	Response.Write "var title='"&Title&"';"
	Response.Write "document.write(exsm_topuser_top());"
	Response.Write "</Script>"
	Set Rs=server.createobject("adodb.recordset")
	rs.open sqluser,stock_conn,1,1
	If not rs.eof Then
		Rs.PageSize=CInt(Exsm.Setting_Info(16))
		If page+0>Rs.PageCount Then page=Rs.PageCount
		Rs.AbsolutePage=page
		ExRs=Rs.GetRows(Rs.PageSize)
		For i=0 To Ubound(ExRs,2)
			If ExRs(15,i)=1 Or Exsm.StockAdmin Or ExRs(0,i)=Exsm.UserID Then
				UserId=ExRs(0,i)
				UserName=ExRs(1,i)
				RankSecret=1
			Else
				UserId=0
				UserName="***"
				RankSecret=0
			End if
			Response.Write "<Script Language=JavaScript>"
			Response.Write "document.write (exsm_user_list('"
			Response.Write Rs.PageSize*page+i-Rs.PageSize+1
			Response.Write "','"
			Response.Write UserId
			Response.Write "','"
			Response.Write Exsm.htmlencode(UserName)
			Response.Write "','"
			Response.Write ExRs(3,i)
			Response.Write "','"
			Response.Write ExRs(4,i)
			Response.Write "','"
			Response.Write ExRs(5,i)
			Response.Write "','"
			Response.Write ExRs(6,i)
			Response.Write "','"
			Response.Write ExRs(7,i)
			Response.Write "','"
			Response.Write ExRs(8,i)
			Response.Write "','"
			Response.Write ExRs(11,i)
			Response.Write "','"
			Response.Write ExRs(12,i)
			Response.Write "','"
			Response.Write ExRs(10,i)
			Response.Write "','"
			Response.Write RankSecret
			Response.Write "'));"
			Response.Write "</Script>"
		Next
		Response.Write "<Script Language=JavaScript>"
		Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
		Response.Write "var page="&page&";"
		Response.Write "var recordcount="&Rs.RecordCount&";"
		Response.Write "var pagesize="&Rs.PageSize&";"
		Response.Write "var pagecount="&Rs.PageCount&";"
		Response.Write "document.write(exsm_topuser_root());"
		Response.Write "</Script>"
	Else
		Response.Write "<Script Language=JavaScript>"
		Response.Write "var assignwidth='"&Exsm.AssignWidth&"';"
		Response.Write "document.write(exsm_topuser_naught());"
		Response.Write "</Script>"
	End if
	Rs.Close
	Set Rs=Nothing
	Exsm.RootShow
End Sub
Sub Reflash()
	If not datediff("n",Session(Exsm.PlaceName&"ExsmTeUserID")(4),Now())>=5 Then
		Exsm.Errmess="<li>您可能刚刚登录或已经刷新过排名，请["&Cint(5-datediff("n",Session(""&Exsm.PlaceName&"ExsmTeUserID")(4),Now()))&"]分钟后再次刷新。"
		Call Exsm.Endinfo(1)
		Exit sub
	Else
		Call Exsm.CalculateFund(0,0)
		Exsm.ExsmUserInfo(4)=Now()
		Session(Exsm.PlaceName&"ExsmTeUserID")=Exsm.ExsmUserInfo
		Exsm.DelStockCahe("ExSm_Imitate_UserSequence")
		response.Redirect Request.ServerVariables("HTTP_REFERER")
	End if
End Sub
%>