<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/dv_clsother.asp"-->
<%
Dim TemplateStr,dhy_rs,dhy_sql,dhy_logic,dhy_company,dhy_list_num,dhy_list_order,orders,rs,sql,i,index,nowpage,page,pages,tmid
Dvbbs.LoadTemplates("")
TemplateStr="<tr><td class={$BgColor}><li>{$VarName}&nbsp;{$VarDesc}</td><td class={$BgColor}>&nbsp;当前值：<font color="&Dvbbs.MainSetting(1)&"><b>{$VarValue}</b></font></td></tr>"
Dvbbs.Stats="个人主页系统"
Dvbbs.Nav()
If Dvbbs.BoardID=0 Then
	Dvbbs.Head_var 2,0,"",""
Else
	Dvbbs.Head_var 1,Dvbbs.Board_Data(4,0),"",""
End If
Set dhy_rs =Dvbbs.Execute("select company,logic,index_list_num,index_list_order from dhy_setup")
dhy_company=dhy_rs("company")
dhy_list_num=dhy_rs("index_list_num")
dhy_list_order=dhy_rs("index_list_order")
dhy_logic=dhy_rs("logic")
dhy_rs.close:set dhy_rs=nothing
Page=request("page")
If Page="" Or Not IsNumerIc(Page) or page=0 Then Page=1
Page=Clng(Page)
set rs=Dvbbs.Execute("select fileid from [dhy_file]")
do while not rs.eof
if tmid="" then
   tmid=rs("fileID")
else
   tmid=tmid&","&rs("fileID")
end if
rs.movenext()
loop
rs.close:set rs=nothing
if tmid="" then tmid=0
call dhy_index()
Dvbbs.ActiveOnline()
Dvbbs.Footer()

function topinfo(str)
Response.Write "<table style=width:100% cellpadding=4 cellspacing=1 align=center class=tableborder1 style=word-break:break-all><tr><th colspan=2>"&str&"</th></tr></table>"
end function

public sub dhy_index()
Response.Write "<table cellpadding=0 cellspacing=0 align=center class=tableborder1 style=word-break:break-all>"
response.write "<tr>"
response.write "<td width=28% class=tablebody2 valign=top>"
topinfo("本期推荐")
Response.Write "<table style=width:100% cellpadding=4 cellspacing=1 class=tableborder1 style=word-break:break-all>"
response.write "<tr><td class=tablebody1>"
if Application("logic")="" then
   Application.Lock
   Application("logic")=Getlogic()
   application.unlock
   response.write Application("logic")
else
   response.write Application("logic")
end if
response.write "</td></tr></table>"
topinfo("人气排行 TOP10")
Response.Write "<table style=width:100% cellpadding=0 cellspacing=1 class=tableborder1 style=word-break:break-all>"
set rs =Dvbbs.Execute("select site_name,user,userid,click_num from [dhy_index] where yn=1 order by click_num desc")
response.write "<tr><td class=tablebody1>"
   Response.Write "<table style=width:100% cellpadding=4 cellspacing=0 class=tableborder1 style=word-break:break-all>"
   response.write "<tr>"
   response.write "<td class=tablebody2 width=40% ><center>主页名称</td>"
   response.write "<td class=tablebody2 width=40% ><center>作者</td>"
   response.write "<td class=tablebody2 width=20% ><center>人气</td>"
   response.write "</tr>"
   for i=1 to 10
   if not rs.eof then
      response.write "<tr>"
	  response.write "<td class=tablebody1>　<a href=dhy_index.asp?usID="&rs("userID")&">"&rs("site_name")&"</a></td>"
	  response.write "<td class=tablebody1><center><a href=dispuser.asp?name="&rs("user")&" title=查看&nbsp;"&rs("user")&"&nbsp;的详细信息>"&rs("user")&"</a></td>"
	  response.write "<td class=tablebody1><center><font color=red>"&rs("click_num")&"</font></td>"
	  response.write "</tr>"
      rs.movenext()
   else
      response.write "<tr><td class=tablebody1 colspan=3><font color=#aaaaaa>　未找到任何主页</font><br></td></tr>"
   end if
   next
   rs.close:set rs=nothing
   response.write "</table>"
response.write "</td></tr></table>"
topinfo("最新文章 TOP10")
Response.Write "<table style=width:100% cellpadding=0 cellspacing=1 class=tableborder1 style=word-break:break-all>"
response.write "<tr><td class=tablebody1>"
   Response.Write "<table style=width:100% cellpadding=4 cellspacing=0 class=tableborder1 style=word-break:break-all>"
   set rs=Dvbbs.Execute("select TopicID,title,postusername,postuserid,dateandtime,child,hits from [Dv_Topic] where TopicID in ("&tmid&") order by dateandtime desc")
   for i=1 to 10
   if not rs.eof then
      response.write "<tr><td class=tablebody1 valign=top><li></td>"
	  response.write "<td class=tablebody1><a href=dhy_disp.asp?ID="&rs("Topicid")&"&usID="&rs("Postuserid")&" title=标题&nbsp;"&rs("title")&"&#13;作者&nbsp;"&rs("postuserName")&"&#13;时间&nbsp;"&formatdatetime(rs("DateAndTime"),1)&"&#13;人气&nbsp;"&rs("hits")&"&#13;回复&nbsp;"&rs("child")&">"&rs("title")&"</a></td>"
	  response.write "</tr>"
      rs.movenext()
   else
      response.write "<tr><td class=tablebody1 width=1% valign=top><li></td>"
	  response.write "<td class=tablebody1><font color=#aaaaaa>未找到任何文章</font><br></td></tr>"
   end if
   next
   rs.close:set rs=nothing
   response.write "</table>"
response.write "</td></tr></table>"
topinfo("论坛虚拟主页说明")
Response.Write "<table style=width:100% cellpadding=8 cellspacing=1 class=tableborder1 style=word-break:break-all>"
response.write "<tr><td class=tablebody1>"
response.write dhy_company
response.write "</td></tr></table>"
response.write "</td>"
response.write "<td class=tablebody1>."
response.write "</td>"
response.write "<td class=tablebody1 valign=top>"
topinfo("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;个人主页列表&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=dhy_reg.asp><font color=red>申请你的主页</font></a>")
Response.Write "<table style=width:100% cellpadding=4 cellspacing=1 class=tableborder1 style=word-break:break-all>"
set rs = server.createobject("adodb.recordset")
if dhy_list_order=0 then
   sql="select site_name,user,userid,file_num,click_num,add_time from dhy_index where yn=1 order by id desc"
elseif dhy_list_order=1 then
   sql="select site_name,user,userid,file_num,click_num,add_time from dhy_index where yn=1 order by click_num desc"
elseif dhy_list_order=2 then
   sql="select site_name,user,userid,file_num,click_num,add_time from dhy_index where yn=1 order by file_num desc"
else
   sql="select site_name,user,userid,file_num,click_num,add_time from dhy_index where yn=1 order by id desc"
end if
rs.open sql,conn,1,3
   response.write "<tr>"
   response.write "<td class=tablebody2 width=30% ><center>主页名称</td>"
   response.write "<td class=tablebody2 width=20% ><center>作者</td>"
   response.write "<td class=tablebody2 width=10% ><center>文章数</td>"
   response.write "<td class=tablebody2 width=10% ><center>人气值</td>"
   response.write "<td class=tablebody2 width=30% ><center>建站时间</td>"
   response.write "</tr>"
   if not rs.eof then
   index = 0
   rs.pagesize=dhy_list_num
   rs.movefirst
   nowpage=page
   rs.absolutepage=nowpage
   pages=rs.PageCount
   do while not rs.eof
      response.write "<tr>"
	  response.write "<td class=tablebody1>　<a href=dhy_index.asp?usID="&rs("userID")&">"&rs("site_name")&"</a></td>"
	  response.write "<td class=tablebody1><center><a href=dispuser.asp?name="&rs("user")&" title=查看&nbsp;"&rs("user")&"&nbsp;的详细信息>"&rs("user")&"</a></td>"
	  response.write "<td class=tablebody1><center>"&rs("file_num")&"</td>"
	  response.write "<td class=tablebody1><center>"&rs("click_num")&"</td>"
	  response.write "<td class=tablebody1><center>"&rs("add_time")&"</td>"
	  response.write "</tr>"
	  index=index+1
	  if index=rs.pagesize then exit do
      rs.movenext()
	  loop
	else
      response.write "<tr>"
	  response.write "<td class=tablebody1 colspan=5>没有找到任何主页！</td>"
	  response.write "</tr>"
	end if
response.write "</td></tr></table>"

Response.Write "<table style=width:100% cellpadding=4 cellspacing=0 class=tableborder1 style=word-break:break-all>"
response.write "<tr>"
response.write "<td class=tablebody2 width=50% >"
response.write "页次：<b>"&nowpage&"</b> / <b>"&pages&"</b> 每页<b>"&rs.pagesize&"</b>条记录 共有<b>"&rs.recordcount&"</b>个主页"
response.write "</td><td class=tablebody2 align=right>"
if pages="" then pages=1
if nowpage="" then nowpage=1
response.write "分页："
   dim xpage,xten,tos
   if nowpage mod 10=0 then
      xpage=nowpage-1
   else
      xpage=nowpage
   end if
   xten=int(xpage/10)*10
   if nowpage=1 then
      response.write "<font face=dhydings color=red>9</font>"
   else
      response.write "<a href=?page=1 title=首页><font face=dhydings>9</font></a>"
   end if
   if nowpage>10 then
      response.write "<a href=?page="&xten&" title=前十页><font face=dhydings>7</font></a>"
   end if
   if pages-xten>11 then
      tos=xten+10
   else
      tos=pages
   end if
   for i=xten+1 to tos
       if i=nowpage then
          response.write " <font color=red><b>"&i&"</b></a> "
	   else
	      response.write " <a href=?page="&i&"><b>"&i&"</b></a> "
	   end if
   next
   if pages-xten>10 then
      response.write "<a href=?page="&xten+11&" title=后十页><font face=dhydings>8</font></a>"
   end if
   if pages=nowpage or pages=1 then
      response.write "<font face=dhydings color=red>:</font>"
   else
      response.write "<a href=?page="&pages&" title=尾页><font face=dhydings>:</font></a>"
   end if
response.write "</td></tr></table>"

rs.close:set rs=nothing
response.write "</td>"
response.write "</tr>"
response.write "</table>"
end sub

function Getlogic()
dim logic
set rs=Dvbbs.Execute("select index_sm,userphoto from [dhy_index] where userid="&dhy_logic)
if not rs.eof then
   if len(rs("userphoto"))=0 then
      logic=rs("index_sm")
   else
      logic=logic&"<table style=width:100% cellpadding=0 cellspacing=0 class=tableborder1 style=word-break:break-all>"
      logic=logic&"<tr>"
      logic=logic&"<td class=tablebody1 width=50% >"
      logic=logic&"<a href=dhy_index.asp?usID="&dhy_logic&"><img src='"&rs("userphoto")&"' width=90 height=120 border=0></a>"
      logic=logic&"</td>"
      logic=logic&"<td class=tablebody1>"
      logic=logic&rs("index_sm")
      logic=logic&"</td>"
      logic=logic&"</tr>"
      logic=logic&"</table>"
   end if
else
   logic="<center>本期没有推荐主页"
end if
Getlogic=logic
end function
%>
