<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: diarylist.asp
' Version:3.0
' Date: 2005-8-19
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
response.buffer=true
dim action
action=Checkstr(Trim(Request("action")))
if action="" then
  	errmsg=errmsg+"<br>"+"<li>参数错误。"
	founderr=true
end if
if action="hot" then
stats="热门日记"
elseif action="new" then
stats="最新日记"
elseif action="best" then
stats="佳作欣赏"
elseif action="name" then
stats="用户日记"
elseif action="usersex" then
  if trim(request("gender"))=1 then
    stats="男生日记"
  else
    stats="女生日记"
  end if
elseif action="type" then
Select Case Cint(request("Typeid"))
	Case 1
	stats="以文会友日记列表"
	Case 2
	stats="生活点滴日记列表"
	Case 3
	stats="情感话题日记列表"
	Case 4
	stats="人生感悟日记列表"
	Case 5
	stats="胡思乱想日记列表"
	Case 6
	stats="此刻心情日记列表"
End Select
elseif action="all" then
stats="所有日记"
end if

call nav()
if not founduser then
  	errmsg=errmsg+"<br>"+"<li>您没有<a href=login.asp target=_blank>登录</a>。"
	founderr=true
end if
if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var("心情日记","diaryindex.asp")
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class=tableborder2>
  <tr>
    <td width="48" height="31" align="right"><img src="Skins/Default/diary/x_line2.gif" width="1" height="30"></td>
    <td width="97" align="center"><a href="diaryindex.asp"><img src="Skins/Default/diary/dh_sy.gif" width="78" height="21" border="0"></a></td>
    <td width="11"><img src="Skins/Default/diary/x_line2.gif" width="1" height="30"></td>
    <td width="83"><a href="userdiary.asp"><img src="Skins/Default/diary/dh_mydaily.gif" width="76" height="21" border="0"></a></td>
    <td width="10"><img src="Skins/Default/diary/x_line2.gif" width="1" height="30"></td>
    <td width="89"><a href="userdiary.asp?action=newdiary"><img src="Skins/Default/diary/dh_fb.gif" width="81" height="21" border="0"></a></td>
    <td width="11"><img src="Skins/Default/diary/x_line2.gif" width="1" height="30"></td>
    <td width="84"><a href="diarylist.asp?action=hot"><img src="Skins/Default/diary/dh_hot.gif" width="74" height="21" border="0"></a></td>
    <td width="10"><img src="Skins/Default/diary/x_line2.gif" width="1" height="30"></td>
    <td width="87"><a href="diarylist.asp?action=new"><img src="Skins/Default/diary/dh_new.gif" width="76" height="21" border="0"></a></td>
    <td width="10"><img src="Skins/Default/diary/x_line2.gif" width="1" height="30"></td>
    <td width="88"><a href="diarylist.asp?action=best"><img src="Skins/Default/diary/dh_best.gif" width="75" height="21" border="0"></a></td>
    <td width="103">&nbsp;</td>
  </tr>
</table>
<%
call tumppages()'翻页处理
strFileName="diarylist.asp?action="&action&"&gender="&Cint(request("gender"))&"&typeid="&Cint(request("Typeid"))&""
call main()
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub main()%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <tr align="center"> 
    <th width="5%" height="27">状态</th>
    <th width="43%">日记主题</th>
    <th width="11%">作者</th>
    <th width="6%">天气</th>
    <th width="7%">人气</th>
    <th width="7%">评论</th>
    <th width="21%">最后更新</th>
  </tr>
  <%dim Did,Tdiary,istop,postname
  set rs=server.createobject("adodb.recordset")
  if action="hot" then
    sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where Checked=1 and Ispublic<>0 and ishot=1 order by Istop desc,Hits desc,Did desc"
  elseif action="new" then
    sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where Checked=1 and Ispublic<>0 order by Istop desc,Addtime desc,Did desc"
  elseif action="best" then
    sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where Checked=1 and Ispublic<>0 and Isbest=1 order by Istop desc,Hits desc,Did desc"
  elseif action="name" then
    sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where Checked=1 and Ispublic<>0 and Username='"&trim(request("username"))&"' order by Istop desc,Did desc"
  elseif action="usersex" then
    sql="select d.did,d.Topic,d.Title,d.Addtime,d.Username,d.Weather,d.hits,d.Disdiary,d.Lasttime,d.LastPost,d.istop from Ms_diary d inner join Ms_user u on d.Username=u.Username where d.Checked=1 and d.Ispublic<>0 and u.UserSex="&Cint(trim(request("gender")))&" order by d.Istop desc,d.Did desc"
elseif action="type" then
    sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where Checked=1 and Ispublic<>0 and typeid="&Cint(request("Typeid"))&" order by Istop desc,Did desc"
elseif action="all" then
    sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where Checked=1 and Ispublic<>0 order by Istop desc,Did desc"
  end if
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
Tdiary=0
do while not rs.eof and page_count<Cint(MaxPerPage)
Did=rs("Did")
Tdiary=Tdiary+1
istop=rs("istop")
postname=rs("Username")
%>
  <tr align="center"> 
    <td width="5%" align="center"  class=tablebody2><%if istop=2 then
	  response.write("<img src=Skins/Default/istop.gif width=17 height=17 border=0 align=""absmiddle"" title=""固顶日记"">")
elseif istop=1 then
response.write("<img src=Skins/Default/isbest.gif width=17 height=17 border=0 align=""absmiddle"" title=""精华日记"">")
else
response.write("<img src=Skins/Default/folder.gif width=17 height=17 border=0 align=""absmiddle"" title=""开放日记"">")
end if%></td>
    <td width="43%" align="left"  class=tablebody1><img src=<%=rs("Topic")%> width=20 border=0 align="absmiddle"><%response.write("<a href=diaryview.asp?Did="&Did&" title=""主题："&rs("Title")&Brstrt&"作者："&postname&Brstrt&"发表于："&rs("Addtime")&""" target=_blank>"&left(rs("Title"),24)&"</a>")
	  if datediff("d",rs("Addtime"),date())<1 then
response.write("&nbsp;<img src=images/new.gif>")
end if%></td>
    <td width="11%" align="center"  class=tablebody2><a href=dispuser.asp?username=<%=postname%>><%=postname%></a></td>
    <td align="center"  class=tablebody1><img src=Skins/Default/weather/<%=rs("Weather")%>.gif border=0 width=13></td>
    <td width="7%" align="center"  class=tablebody1><%if rs("hits")>=Clicknums then
	response.write("<font color=red>"&rs("hits")&"</font>")
	else
	response.write(""&rs("hits")&"")
	end if%></td>
    <td width="7%" align="center"  class=tablebody1><%=rs("Disdiary")%></td>
    <td align="center"  class=tablebody2><%=replace(rs("Lasttime"),right(rs("Lasttime"),3),"")%> <font color=red>|</font> <a href=dispuser.asp?username=<%=rs("LastPost")%>><%=rs("LastPost")%></a></td>
  </tr>
  <%page_count=page_count+1
  rs.movenext
  loop
  else
  response.write("<tr align=""center""><td height=""30"" colspan=""7"" align=""center""  class=tablebody1>还没有日记，请添加日记！</td></tr>")
  end if
  rs.close
  %>
  <tr align="center"> 
    <td height="32" colspan="7" align="left"  class=tablebody2> 
      <%if totalrec>0 then
		  	call showpage(strFileName)
		  end if%></td>
  </tr>
  <tr align="center"> 
    <td height="29" colspan="7"  class=tablebody1><img src="Skins/Default/folder.gif" width="18" height="17" align="absmiddle"> 
      开放日记　<img src="Skins/Default/isbest.gif" width="17" height="17" align="absmiddle"> 
      精华日记　 <img src="Skins/Default/istop.gif" width="17" height="17" align="absmiddle"> 
      固顶日记 </td>
  </tr>
</table>
<%
end sub
%>
</body>
</html>  