<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: search.asp
' Version:3.0
' Date: 2005-11-3
' 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
'=========================================================
dim Srs,sqls,sqlstr
response.buffer=true
stats="分类搜索"
call nav()
if not founduser then
	Errmsg=Errmsg+"<br>"+"<li>您还没有登陆，请登陆后进行修改。"
	founderr=true
end if

if founderr then
	call head_var("","")
	call Mslove_error()
else
	call head_var("分类搜索","search.asp")
call tumppages()'翻页处理
Select Case Trim(Request("action"))
	Case "Usearch"
		Stats="会员搜索结果"
		call Userlist()
	Case "psearch"
		Stats="约会搜索结果"
		call partlist()
	Case "dsearch"
		Stats="日记搜索结果"
		call diarlist()
	case "asearch"
		Stats="文章搜索结果"
		call artlist()
	case else	
		call main()
End Select
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="left"> 
    <th width="100%" height="28" align="center"  class=tablebody1>分类搜索</th>
  </tr>
  <tr align="center"> 
    <td width="100%" height="25"  class=tablebody1> <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="22" align="center"><font color="#0000FF">友情提示：<font color="#FF0000">VIP会员</font>在分类搜索中有更高的权限，可以搜索：被锁定用户、等级比自已高的用户、锁定文章、未审约会及日记等！</font></td>
        </tr>
      </table>
      <table  class=tableborder2 cellspacing=0 cellpadding=3 width="100%" border=0>
        <form action="?action=Usearch" method=POST name="theForm">
          <tbody>
            <tr> 
              <td height="27" align=center class=tablebody1>会员高级搜索</td>
            </tr>
            <tr> 
              <td height="33" align=left>会员姓名： 
                <input name="SearchUser" type="text" id="SearchUser" size="20" maxlength="20"> 
                <input name="likes" type="checkbox" id="likes" value="1">
                完全区配　性　别： 
                <select name=Gender>
				<option value="" selected></option>
                  <option value="1">男性</option>
                  <option value="0">女性</option>
                </select>
                照片 
                <select name=Userpics>
				<option value="" selected></option>
                  <option value=1>有照片</option>
                  <option value=0>无所谓</option>
                </select>
                几天内登录 
                <input name="Loginday" type="text" id="Loginday" size="3" maxlength="5"> 
              </td>
            </tr>
            <tr align=middle> 
              <td height=32 align="left">年　　龄： 
                <select name="Minage">
                  <option selected></option>
                  <option value=0>0</option>
                  <option 
                          value=15>15</option>
                  <option value=20 >20</option>
                  <option value=25>25</option>
                  <option value=30>30</option>
                  <option 
                          value=35>35</option>
                  <option value=40>40</option>
                  <option value=45>45</option>
                  <option 
                          value=50>50</option>
                  <option value=55>55</option>
                  <option value=60>60</option>
                  <option 
                          value=65>65</option>
                  <option 
                        value=70>70</option>
                </select>
                到 
                <select name="Maxage">
                  <option selected></option>
                  <option 
                          value=70>70</option>
                  <option value=65>65</option>
                  <option value=60>60</option>
                  <option 
                          value=55>55</option>
                  <option value=50>50</option>
                  <option value=45>45</option>
                  <option 
                          value=40>40</option>
                  <option value=35>35</option>
                  <option value=30>30</option>
                  <option 
                          value=25>25</option>
                  <option value=20>20</option>
                  <option value=15>15</option>
                  <option value=0>0</option>
                </select>
                岁 　身　高： 
                <select name=Minheight>
                  <option selected></option>
                  <option value=110>110</option>
                  <option value=150>150</option>
                  <option value=155>155</option>
                  <option value=160>160</option>
                  <option value=165>165</option>
                  <option value=170>170</option>
                  <option value=175>175</option>
                  <option value=180>180</option>
                  <option value=185>185</option>
                  <option value=190>190</option>
                  <option value=195>195</option>
                  <option value=200>200</option>
                </select>
                到 
                <select name=Maxheight>
                  <option selected></option>
                  <option value=200>200</option>
                  <option value=195>195</option>
                  <option value=190>190</option>
                  <option value=185>185</option>
                  <option value=180>180</option>
                  <option value=175>175</option>
                  <option value=170>170</option>
                  <option value=165>165</option>
                  <option value=160>160</option>
                  <option value=155>155</option>
                  <option value=150>150</option>
                  <option value=110>110</option>
                </select>
                CM　身　份： 
                <select name=status>
				<option value="" selected></option>
                  <option value=1>普通会员</option>
                  <option value=2>VIP会员</option>
                </select> <input class=an type=submit value="搜 索" name=submit2> 
              </td>
            </tr>
        </form>
      </table></td>
  </tr>
  <tr align="center"> 
    <td width="100%"  class=tablebody1 align="left"> <script language="JavaScript" src="inc/Mymodify.js"></script> 
      <table  class=tableborder2 cellspacing=0 cellpadding=3 width="100%" border=0>
        <form action="?action=psearch" method=POST name="parForm">
          <tbody>
            <tr> 
              <td height="27" align=center class=tablebody1>同城约会搜索</td>
            </tr>
            <tr> 
              <td height="15" align=left>约会标题： 
                <input name="Ptitle" type="text" id="Ptitle" size="40" maxlength="100">
                性　别： 
                <select name=Gender id="Gender">
				 <option value="" selected></option>
                  <option value="1">男性</option>
                  <option value="0">女性</option>
                  <option value="2">不限</option>
                </select>
                类型： 
                <input name="Ispublic" type="radio" value="0">
                公开 
                <input type="radio" name="Ispublic" value="1">
                单独 </td>
            </tr>
            <tr> 
              <td height="15" align=left>所在省份： 
                <input type=text name=province size=12> <select name="selectp" onChange="selectcityarea('selectp','selectc','parForm');parForm.province.value=this.value;">
                  <option value="0" selected>请选择..</option>
                </select>
                约会城市： 
                <input type=text name=city size=12> <select name="selectc" onChange="parForm.city.value=this.value;">
                  <option value="0" selected>请选择..</option>
                </select>
                （*省份城市必选）</td>
            </tr>
            <tr> 
              <td height="34" align=left>发 起 人： 
                <input name="partname" type="text" id="partname" size="20" maxlength="20"> 
                <input name="likes" type="checkbox" id="likes" value="1">
                完全区配 约会日期： 
                <input name=Partydate type=text onfocus="show_cele_date(Partydate,'','',Partydate)" size="20"> 
                <input name=submit type=submit id="submit" value="搜 索"> </td>
            </tr>
        </form>
      </table>
      <script>
first("selectp","selectc","parForm",0,0);
</script> </td>
  </tr>
  <tr align="center"> 
    <td  class=tablebody1 align="left"><table  class=tableborder2 cellspacing=0 cellpadding=3 width="100%" border=0>
        <form action="?action=dsearch" method=POST name="theForm">
          <tbody>
            <tr> 
              <td height="27" align=center class=tablebody1>会员日记搜索</td>
            </tr>
            <tr> 
              <td height="30" align=left>日记标题： 
                <input name="Ptitle" type="text" id="Ptitle" size="40" maxlength="100"> 
                <input type=submit value="搜 索" name=submit> </td>
            </tr>
            <tr> 
              <td height="34" align=left>日记写手： 
                <input name="Username" type="text" id="Username" size="20" maxlength="20"> 
                <input name="likes" type="checkbox" id="likes" value="1">
                完全区配 几天之内发表： <input name="diaryday" type="text" id="diaryday" size="3" maxlength="5"></td>
            </tr>
        </form>
      </table></td>
  </tr>
  <tr align="center">
    <td  class=tablebody1 align="left"><table  class=tableborder2 cellspacing=0 cellpadding=3 width="100%" border=0>
        <form action="?action=asearch" method=POST name="theForm">
          <tbody>
            <tr> 
              <td height="27" align=center class=tablebody1>玫瑰文章搜索</td>
            </tr>
            <tr> 
              <td height="30" align=left>关 键 词： 
                <input name="keyword" type="text" id="keyword" size="40" maxlength="100">
                <select name="sclass" id="sclass">
				<option value="" selected></option>
                  <option value="1">标题</option>
                  <option value="2">全文</option>
                </select> 
                <input type=submit value="搜 索" name=submit3> </td>
            </tr>
        </form>
      </table></td>
  </tr>
</table>
<%
end sub

sub Userlist()''会员搜索开始
dim Gender,Minage,Maxage,Minheight,Maxheight,Userpics,userstatus
dim orders,ordername,Starname,StarVip,likes
dim stat,OnlineTime,SearchUser,Loginday,splitfriend
dim min_byear,max_byear,Min_hei,Max_hei
sqlstr=""
SearchUser=checkStr(trim(request("SearchUser")))
likes=trim(request("likes"))
Gender=trim(request("Gender"))
Minage=trim(request("Minage"))
Maxage=trim(request("Maxage"))
Minheight=trim(request("Minheight"))
Maxheight=trim(request("Maxheight"))
Userpics=trim(request("Userpics"))
userstatus=trim(request("status"))
Loginday=trim(request("Loginday"))
if SearchUser<>"" then''搜索会员名称
  	if likes="" then
  	sqlstr=" Username like '%"&SearchUser&"%' "
  	else
  	sqlstr=sqlstr& " and Username='"&SearchUser&"' "
  	end if
end if
if Minage<>"" and Maxage<>"" then
   if Minage<Maxage then'判断年龄
      min_byear=year(date)-Minage
      max_byear=year(date)-Maxage
   else
      min_byear=year(date)-Maxage
      max_byear=year(date)-Minage
   end if
end if
   if Minage<>"" and Maxage<>"" then
     	if sqlstr="" then
        	sqlstr=" (year(Userbirthday) between "&min_byear&" and "&max_byear&") "
	    else
	    	sqlstr=sqlstr& " and (year(Userbirthday) between "&min_byear&" and "&max_byear&") "
	   	end if
   end if

if Gender<>"" then''性别搜索
  	if sqlstr="" then
  	  	sqlstr=" usersex="&Gender&" "
  	else
  	  	sqlstr=sqlstr& " and usersex="&Gender&" "
  	end if
end if
if Userpics<>"" then''照片搜索
  	if sqlstr="" then
  	  	sqlstr=" UserPics>0 "
  	else
  	  	sqlstr=sqlstr& " and UserPics>0 "
  	end if
end if

if userstatus<>"" then''VIP会员
  	if sqlstr="" then
  	  	if userstatus=1 then
  	  	  	sqlstr=" UserVip<="&userstatus&" "
  	  	else
  	  	  	sqlstr=" UserVip>="&userstatus&" "
  	  	end if
  	else
  	  	if userstatus=1 then
  	   		sqlstr=sqlstr& " and UserVip<="&userstatus&" "
  	  	else
  	   		sqlstr=sqlstr& " and UserVip>="&userstatus&" "
   		end if
  	end if
end if

if Minheight<Maxheight then
  	Min_hei=Minheight
  	Max_hei=Maxheight
else
  	Min_hei=Maxheight
  	Max_hei=Minheight
end if
   if Min_hei<>"" and Max_hei<>"" then
     	if sqlstr="" then
        	sqlstr=" (Userheight between "&Min_hei&" and "&Max_hei&") "
	    else
	    	sqlstr=sqlstr& " and (Userheight between "&Min_hei&" and "&Max_hei&") "
	    end if
   end if
   
if Loginday<>"" then
  	if sqlstr="" then
  	  	sqlstr=" datediff('d',LastLogin,Now())<"&Loginday&" "
  	else
  	  	sqlstr=sqlstr& " and datediff('d',LastLogin,Now())<"&Loginday&" "
  	end if
end if
if sqlstr="" then
  	errmsg=errmsg+"<br>"+"<li>搜索条件不能为空。"
	founderr=true
	exit sub
end if
strFileName="search.asp?action="&Request("action")&"&SearchUser="&SearchUser&"&likes="&likes&"&Minage="&Minage&"&Maxage="&Maxage&"&Gender="&Gender&"&Userpics="&Userpics&"&status="&userstatus&"&Minheight="&Minheight&"&Maxheight="&Maxheight&"&Loginday="&Loginday&""
%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
    <tr align="center"> 
      
    <th height="27" colspan=12><%=stats%> </th>
    </tr>
  <tr align="center"> 
    <td width="129" height="31" class=tablebody2>用户名</td>
    <td width="47" class=tablebody2>性别</td>
    <td width="45" class=tablebody2>年龄</td>
    <td width="55" class=tablebody2>相册</td>
    <td width="55" class=tablebody2>日记</td>
    <td width="60" class=tablebody2>文章</td>
    <td width="63" class=tablebody2>人气</td>
    <td width="71" class=tablebody2>在线会员</td>
    <td width="67" class=tablebody2>等级状态</td>
    <td width="121" class=tablebody2>对象操作</td>
  </tr>
  <%
	set rs=server.createobject("adodb.recordset")
	if Supermaster or master or standmaster  or Vipuser then
		sql="select userid,LockUser,Username,UserVip,Usersex,Userbirthday,UserPics,Userdiary,Userart,UserViews,userclass,Userfriends from [Ms_user] where "&sqlstr&" order by userid"
		else
		sql="select userid,LockUser,Username,UserVip,Usersex,Userbirthday,UserPics,Userdiary,Userart,UserViews,userclass,Userfriends from [Ms_user] where "&sqlstr&" and LockUser=0 order by userid"
		end if
	rs.open sql,conn,1
	if rs.eof and rs.bof then
		response.write "<tr><td colspan=10 class=tablebody1 align=center>还没有任何用户数据。</td></tr>"
	else
call rspages()
	do while not rs.eof and page_count<Cint(MaxPerPage)
	Starname=rs("Username")
	StarVip=rs("UserVip")
if Supermaster or master then
	set Srs=conn.execute("select stats,startime from Ms_online where userid="&rs("userid"))
	else
	set Srs=conn.execute("select stats,startime from Ms_online where userid="&rs("userid")&" and userhidden=2")
	end if
	if Srs.eof and Srs.bof then
	stat=""
	OnlineTime="[离线]"
	else
	stat="当前位置：["&Srs(0)&"]"
	OnlineTime="[在线：" & datediff("n",Srs(1),Now()) & "Mins]"
	end if
	Srs.close
	set Srs=nothing
%>
  <tr> 
    <td height="27" class=tablebody1>&nbsp;<a href=dispuser.asp?Username=<%=Starname%> target=_blank><%=Starname%></a> <%if StarVip>1 then
	response.write("&nbsp;<img src=Skins/Default/vip.gif title=Vip会员>")
	end if
	if rs("LockUser")=1 then
		response.write "&nbsp;<img src=Skins/Default/userlock.gif title=锁定状态 align=absmiddle>"
	elseif rs("LockUser")=2 then
		response.write "&nbsp;<img src=Skins/Default/useroff.gif title=屏蔽状态 align=absmiddle>"
	end if%> </td>
    <td height="27" align="center" class=tablebody1><%=iif(rs("Usersex"),"酷哥","靓女")%></td>
    <td height="27" align="center" class=tablebody1><%=datediff("yyyy",rs("Userbirthday"),Now())%></td>
    <td align=center class=tablebody1><%=rs("UserPics")%></td>
    <td align=center class=tablebody1><%=rs("Userdiary")%></td>
    <td align=center class=tablebody1><%=rs("Userart")%></td>
    <td align=center class=tablebody1><%=rs("UserViews")%></td>
    <td align=center class=tablebody1> <%if stat<>"" then
	response.write("<img src=Skins/Default/online1.gif title="&stat&OnlineTime&">")
	else
	response.write("<img src=Skins/Default/offline1.gif title="&OnlineTime&">")
	end if%> </td>
    <td align=center class=tablebody1><%=rs("userclass")%></td>
    <td align=center class=tablebody1><a href="javascript:openScript('messanger.asp?action=new&touser=<%=htmlencode(Starname)%>',500,400)">短信</a> 
      <font color="#FF0000">|</font> <a href="friendlist.asp?action=addF&myFriend=<%=HTMLEncode(Starname)%>" target=_blank>好友</a> 
      <font color="#FF0000">|</font> <a href="userbook.asp?action=add&ClassID=2&Touser=<%=HTMLEncode(Starname)%>" target=_blank>留言</a></td>
  </tr>
  <%page_count=page_count+1
	rs.movenext
	loop
	end if
	rs.close
  if totalrec>0 then%>
  <tr align="center"> 
    <td height="29" align="left"  class=tablebody1> <%
		  	call showpage(strFileName)
		  %> </td>
  </tr>
  <%end if%>
</table>
<%
end sub

sub partlist()''同城约会开始
dim Ptitle,province,city,partname,Partydate,Gender,Ispublic,likes
partname=checkStr(trim(request("partname")))
likes=trim(request("likes"))
Gender=trim(request("Gender"))
Ptitle=trim(request("Ptitle"))
province=trim(request("province"))
city=trim(request("city"))
Partydate=trim(request("Partydate"))
Ispublic=trim(request("Ispublic"))
sqlstr=""
if partname<>"" then''搜索会员名称
  	if likes="" then
  	  	sqlstr=" Username like '%"&partname&"%' "
  	else
  	  	sqlstr=sqlstr& "and Username='"&partname&"' "
  	end if
end if
if province<>"" then
  	if sqlstr="" then
  	  	sqlstr=" Province like '%"&province&"%' "
  	else
  	  	sqlstr=sqlstr& " and Province like '%"&province&"%' "
  	end if
end if
if City<>"" then
  	if sqlstr="" then
   		sqlstr=" Province like '%"&city&"%' "
  	else
  	  	sqlstr=sqlstr& " and Province like '%"&city&"%' "
  	end if
end if
if Gender<>"" then
  	if sqlstr="" then
  	  	sqlstr=" Parsex="&Gender&" "
  	else
  	  	sqlstr=sqlstr& " and Parsex="&Gender&" "
  	end if
end if
if Ptitle<>"" then
  	if sqlstr="" then
  	  	sqlstr=" Title like '%"&Ptitle&"%' "
  	else
  	  	sqlstr=sqlstr& " and Title like '%"&Ptitle&"%' "
  	end if
end if
if Partydate<>"" then
  	if sqlstr="" then
  	  	If IsSqlDataBase=1 Then
  	  	  	sqlstr=" PartyDate='"&Partydate&"' "
  	  	else
  	  	  	sqlstr=" PartyDate=#"&PartyDate&"#"
  	  	end if
  	else
  	  	If IsSqlDataBase=1 Then
  	  	sqlstr=sqlstr&" and PartyDate='"&PartyDate&"'"
  	  	else
  	  	sqlstr=sqlstr&" and PartyDate=#"&PartyDate&"#"
    	end if
  	end if
end if
if Ispublic<>"" then
  	if sqlstr="" then
  	  	sqlstr=" Ispublic="&Ispublic&" "
  	else
  	  	sqlstr=sqlstr& " and Ispublic="&Ispublic&" "
  	end if
end if
if sqlstr="" then
  	errmsg=errmsg+"<br>"+"<li>搜索条件不能为空。"
	founderr=true
	exit sub
end if
strFileName="search.asp?action="&Request("action")&"&partname="&partname&"&likes="&likes&"&province="&province&"&city="&city&"&Gender="&Gender&"&Ptitle="&Ptitle&"&Partydate="&Partydate&"&Ispublic="&Ispublic&""
%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class=tableborder1>
  <tr align="center"> 
    <th height="25" colspan="8"><%=stats%> </th>
  </tr>
  <tr align="center"> 
    <td height="31" class=tablebody2>约会名称</td>
    <td width="9%" class=tablebody2>城市</td>
    <td width="12%" class=tablebody2>昵称</td>
    <td width="12%" class=tablebody2>约会日期</td>
    <td width="11%" class=tablebody2>性　质</td>
    <td width="13%" class=tablebody2>要　求</td>
    <td width="10%" class=tablebody2>约会/响应</td>
    <td width="6%" class=tablebody2>人气</td>
  </tr>
  <%dim Pid,Userage,Typeid,parsex
  set rs=server.createobject("adodb.recordset")
   if Supermaster or master or Standmaster or Vipuser then
  sql="select pid,Title,City,username,Maxnum,Userjoin,Minage,Maxage,Parsex,PartyDate,Typeid,hits,Addtime from Ms_party where "&sqlstr&" order by addtime desc"
  else
  sql="select pid,Title,City,username,Maxnum,Userjoin,Minage,Maxage,Parsex,PartyDate,Typeid,hits,Addtime from Ms_party where "&sqlstr&" and Checked=1 order by addtime desc"
  end if
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
Pid=rs("Pid")
City=rs("City")
Typeid=rs("Typeid")
parsex=rs("Parsex")%>
  <tr> 
    <td height="28"  class=tablebody1>&nbsp;<a href=partyshow.asp?Pid=<%=pid%> title=浏览约会内容><%=rs("Title")%></a>
      <%if datediff("d",rs("Addtime"),date())<=1 then
response.write("&nbsp;<img src=images/new.gif>")
end if%></td>
    <td align="center"  class=tablebody1><%=city%></td>
    <td align="center"  class=tablebody1><a href=dispuser.asp?username=<%=rs("username")%>><%=rs("username")%></a></td>
    <td align="center"  class=tablebody1><%=datevalue(rs("PartyDate"))%></td>
    <td align="center"  class=tablebody1>
      <%if Typeid=1 then
	response.write("征友")
	elseif Typeid=2 then
	response.write("恋人")
	elseif Typeid=3 then
	response.write("节日")
	elseif Typeid=4 then
	response.write("纪念")
	elseif Typeid=5 then
	response.write("旅游")
	else
	response.write("其它")
	end if%>
    </td>
    <td align="center"  class=tablebody1>
      <%if parsex=2 then
	response.Write("无要求")
	elseif parsex=1 then
	response.Write("男")
	else
	response.Write("女")
	end if%>
      (<%=rs("Minage")%>-<%=rs("Maxage")%>)</td>
    <td align="center"  class=tablebody1><%=rs("Maxnum")%> / <font color=red><%=rs("Userjoin")%></font></td>
    <td 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>
  </tr>
  <%page_count=page_count+1
  rs.movenext
  loop
  end if
  rs.close
  if totalrec>0 then%>
  <tr align="center"> 
    <td height="29" align="left"  class=tablebody1> <%
		  	call showpage(strFileName)
		  %> </td>
  </tr>
  <%end if%>
</table>
<%
end sub

sub diarlist()
dim Did,Tdiary,istop,postname,style
dim ptitle,username,diaryday,likes,addtime
username=checkStr(trim(request("username")))
diaryday=checkStr(trim(request("diaryday")))
Ptitle=checkStr(trim(request("Ptitle")))
likes=checkStr(trim(request("likes")))
addtime=checkStr(trim(request("addtime")))
style=checkStr(trim(request("style")))
sqlstr=""
strFileName="search.asp?action="&Request("action")&"&username="&username&"&likes="&likes&"&Ptitle="&Ptitle&"&diaryday="&diaryday&"&addtime="&request("addtime")&"&style="&request("style")&""
if username<>"" then
  	if likes=1 then
  	  	sqlstr=" username='"&username&"' "
  	else
    		sqlstr=" username like'%"&username&"%' "
  	end if
end if
if Ptitle<>"" then
  	if style=2 then
  	  	if sqlstr="" then
  	  	sqlstr=" Title like '%"&Ptitle&"%' "
  	  	else
  	  	sqlstr=sqlstr&" and Title like '%"&Ptitle&"%' "
  	  	end if
  	else
  	  	if sqlstr="" then
  	  	  	sqlstr=" Username like '%"&Ptitle&"%' "
  	  	else
  	  	  	sqlstr=sqlstr&" and Username like '%"&Ptitle&"%' "
  	  	end if
  	end if
end if
if diaryday<>"" then
  	if sqlstr="" then
  	  	sqlstr=" datediff('d',Datetime,Now())<"&diaryday&" "
  	else
  	  	sqlstr=sqlstr&" and datediff('d',Datetime,Now())<"&diaryday&" "
  	end if
end if
if addtime<>"" then
  	if sqlstr="" then
  	  	If IsSqlDataBase=1 Then
  	  	  	sqlstr=" Datetime='"&addtime&"'"
  	  	else
  	  	  	sqlstr=" Datetime=#"&addtime&"#"
  	  	end if
  	else
  	  	If IsSqlDataBase=1 Then
  	  	sqlstr=sqlstr&" and Datetime='"&addtime&"'"
  	  	else
  	  	sqlstr=sqlstr&" and Datetime=#"&addtime&"#"
    	end if
  	end if
end if
if sqlstr="" then
  	errmsg=errmsg+"<br>"+"<li>搜索条件不能为空。"
	founderr=true
	exit sub
end if
%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <tr align="center"> 
    <th height="25" colspan="7"><%=stats%></th>
  </tr>
  <tr align="center"> 
    <td width="5%" height="27" class=tablebody2>状态</td>
    <td width="43%" class=tablebody2>日记主题</td>
    <td width="11%" class=tablebody2>作者</td>
    <td width="6%" class=tablebody2>天气</td>
    <td width="7%" class=tablebody2>人气</td>
    <td width="7%" class=tablebody2>评论</td>
    <td width="21%" class=tablebody2>最后更新</td>
  </tr>
  <%
  set rs=server.createobject("adodb.recordset")
  if Supermaster or master or standmaster  or Vipuser then
    sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where "&sqlstr&" order by Istop desc,Did"
	else
	sql="select did,Topic,Title,Addtime,Username,Weather,hits,Disdiary,Lasttime,LastPost,istop from Ms_diary where "&sqlstr&" and Checked=1 order by Istop desc,Did"
	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
  if totalrec>0 then%>
  <tr align="center"> 
    <td height="29" align="left"  class=tablebody1> <%
		  	call showpage(strFileName)
		  %> </td>
  </tr>
  <%end if%>
</table>
<%
end sub

sub artlist()''文章搜索开始
dim keyword,sclass
keyword=checkStr(trim(request("keyword")))
sclass=checkStr(trim(request("sclass")))
strFileName="search.asp?action="&Request("action")&"&keyword="&keyword&"&sclass="&sclass&""
if Keyword<>"" then
if sclass=1 then
sqlstr=" Title like '%"&Keyword&"%' "
elseif sclass=2 then
sqlstr=" Content like '%"&Keyword&"%' "
end if
end if
if sqlstr="" then
  	errmsg=errmsg+"<br>"+"<li>搜索条件不能为空。"
	founderr=true
	exit sub
end if%>
<table width="100%" align=center cellpadding=3 cellspacing=1 class=tableborder1>
  <tr align="center"> 
    <th height="28"  class=tablebody1><%=stats%></th>
  </tr>
  <tr align="center"> 
    <td height="28" class=tablebody2>主　　题</td>
  </tr>
  <%dim Istop,Lastpostlist
	set rs=server.createobject("adodb.recordset")
	if Supermaster or master or standmaster  or Vipuser then
    sql="select id,title,Username,Hits,Ubbs,Addtime,Boardid from Ms_Article where "&sqlstr&" and locktopic=0 order by id desc"
	else
	sql="select id,title,Username,Hits,Ubbs,Addtime,Boardid from Ms_Article where "&sqlstr&" and Checked=1 order by id desc"
	end if
	rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)%>
  <tr align="center"> 
    <td height="24" align="left"  class=tablebody1>&nbsp;<img src=images/artimg/list_nav_spacer.gif> 
      <%response.write("<a href=showart.asp?Boardid="&rs(6)&"&ID="&rs(0)&" title=""主题："&rs(1)&Brstrt&"发表于："&rs(5)&""" target=_blank>"&left(rs(1),22)&"</a>")
	  if datediff("d",rs(5),date())<1 then
response.write("&nbsp;<img src=images/new.gif>")
end if%>
      [<%=datevalue(rs(5))%>]</td>
  </tr>
  <%page_count=page_count+1
	rs.movenext
  loop
  else
  response.write("<tr align=""center""><td height=""30"" colspan=""1"" align=""center""  class=tablebody1>无记录！</td></tr>")
  end if
  rs.close
  if totalrec>0 then%>
  <tr align="center"> 
    <td height="29" align="left"  class=tablebody1> <%
		  	call showpage(strFileName)
		  %> </td>
  </tr>
  <%end if%>
</table>
<%
end sub
%>
</body>
</html> 