<!--#include file=conn.asp-->
<%
dim rs, exec, s,  url, port
const topNum=10		'首页调用留言数量
const maxLen=20		'首页调用留言标题字符长度限制
const old_color="666666"	'旧留言日期的颜色
const new_color="red"	'新留言日期的颜色
const showTime=true	'是否显示日期显示设为true，不显示设为false
const showPic=true		'是否显示用户名后的小图
const showname=true	'是否显示用户名

port=request.servervariables("server_port")
url= "http://"&request.servervariables("server_name")
if (port<>80) then
	url=url &":"& port
end if
url=url & replace(request.servervariables("script_name"),"js.asp","")
exec="select top "& topNum &" * from ly order by id desc"
set rs=conn.execute(exec)
if rs.eof then
	s= "暂时没有留言！"
else
	if showTime and showname and showpic then
		do until rs.eof
			s=s&"<img  src="& url &"images/"& rs("pic") &"> "
			if rs("rt")>0 then
				s=s&"<font face=wingdings>&#230;</font><a href="& url &"show.asp?id="& rs("rt") &"#"& rs("id") &" target=_blank>"
			else
				s=s&"<a href="& url &"show.asp?id="& rs("id") &" target=_blank>"
			end if
			
			if len(rs("title"))<=maxLen then
				s=s&rs("title")
			else
				s=s&left(rs("title"),maxLen)&"..."
			end if
			s=s&"</a> ("
			if rs("t")>date then
				s=s & "<font color=" & new_color & ">" & formatdatetime(rs("t"),2)  & "</font>,"
			else
				s=s & "<font color="& old_color & ">"& formatdatetime(rs("t"),2)  & "</font>,"
			end if
			s=s & rs("name")
			if rs("bl")=1 then
				if isMaster(rs("name")) then
					s=s&"<img src="& url &"images/bz.gif>"
				else
					s=s&"<img src="& url &"images/bl.gif>"
				end if
			end if
			s=s& ")<br>"
			rs.movenext
		loop
	elseif showTime and showname then
		do until rs.eof
			s=s&"<img  src="& url &"images/"& rs("pic") &"> "
			if rs("rt")>0 then
				s=s&"<font face=wingdings>&#230;</font><a href="& url &"show.asp?id="& rs("rt") &"#"& rs("id") &" target=_blank>"
			else
				s=s&"<a href="& url &"show.asp?id="& rs("id") &" target=_blank>"
			end if
			if len(rs("title"))<=maxLen then
				s=s&rs("title")
			else
				s=s&left(rs("title"),maxLen)&"..."
			end if
			s=s&"</a> ("
			if rs("t")>date then
				s=s & "<font color=" & new_color & ">" & formatdatetime(rs("t"),2)  & "</font>,"
			else
				s=s & "<font color="& old_color & ">"& formatdatetime(rs("t"),2)  & "</font>,"
			end if
			s=s & rs("name")
			s=s&")<br>"
			rs.movenext
		loop
	elseif showname and showpic then
		do until rs.eof
			s=s&"<img  src="& url &"images/"& rs("pic") &"> "
			if rs("rt")>0 then
				s=s&"<font face=wingdings>&#230;</font><a href="& url &"show.asp?id="& rs("rt") &"#"& rs("id") &" target=_blank>"
			else
				s=s&"<a href="& url &"show.asp?id="& rs("id") &" target=_blank>"
			end if
			
			if len(rs("title"))<=maxLen then
				s=s&rs("title")
			else
				s=s&left(rs("title"),maxLen)&"..."
			end if
			
			s=s&"</a> ("
			s=s & rs("name")
			if rs("bl")=1 then
				if isMaster(rs("name")) then
					s=s&"<img src="& url &"images/bz.gif>"
				else
					s=s&"<img src="& url &"images/bl.gif>"
				end if
			end if
			s=s&")<br>"
			rs.movenext
		loop
	elseif showname then
		do until rs.eof
			s=s&"<img  src="& url &"images/"& rs("pic") &"> "
			if rs("rt")>0 then
				s=s&"<font face=wingdings>&#230;</font><a href="& url &"show.asp?id="& rs("rt") &"#"& rs("id") &" target=_blank>"
			else
				s=s&"<a href="& url &"show.asp?id="& rs("id") &" target=_blank>"
			end if
			
			if len(rs("title"))<=maxLen then
				s=s&rs("title")
			else
				s=s&left(rs("title"),maxLen)&"..."
			end if
			
			s=s&"</a> ("
			s=s & rs("name")
			s=s&")<br>"
			rs.movenext
		loop
	elseif showtime then
		do until rs.eof
			s=s&"<img  src="& url &"images/"& rs("pic") &"> "
			if rs("rt")>0 then
				s=s&"<font face=wingdings>&#230;</font><a href="& url &"show.asp?id="& rs("rt") &"#"& rs("id") &" target=_blank>"
			else
				s=s&"<a href="& url &"show.asp?id="& rs("id") &" target=_blank>"
			end if
			if len(rs("title"))<=maxLen then
				s=s&rs("title")
			else
				s=s&left(rs("title"),maxLen)&"..."
			end if
			s=s&"</a> ("
			if rs("t")>date then
				s=s & "<font color=" & new_color & ">" & formatdatetime(rs("t"),2)  & "</font>"
			else
				s=s & "<font color="& old_color & ">"& formatdatetime(rs("t"),2)  & "</font>"
			end if
			s=s&")<br>"
			rs.movenext
		loop
	else
		do until rs.eof
			s=s&"<img  src="& url &"images/"& rs("pic") &"> "
			if rs("rt")>0 then
				s=s&"<font face=wingdings>&#230;</font><a href="& url &"show.asp?id="& rs("rt") &"#"& rs("id") &" target=_blank>"
			else
				s=s&"<a href="& url &"show.asp?id="& rs("id") &" target=_blank>"
			end if
			if len(rs("title"))<=maxLen then
				s=s&rs("title")
			else
				s=s&left(rs("title"),maxLen)&"..."
			end if
			s=s&"</a><br>"
			rs.movenext
		loop
	end if



end if
's=replace(s,"""","")
response.write "document.write('"&s&"');"
rsclose()
connclose()
%>