<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<!--#include file="function.asp"-->
<!--#include file="char.inc"-->
<%if request.cookies(echsys)("key")<>"" then%>
<!--#include file="ChkUser.asp"-->
<%end if
const MaxPerPage=10
dim totalPut
dim CurrentPage
dim TotalPages
dim a,j

if not isempty(request("page")) then
	currentPage=cint(request("page"))
else
	currentPage=1
end if

if request.cookies(echsys)("key")="super" then
	aaas=1
	set urs=server.createobject("adodb.recordset")
	sql="select * from "& db_User_Table &" where "& db_User_Name &"='"& ChkRequest(Request.cookies(echsys)("username"), 0)&"'"
	urs.open sql,ConnUser,1,3
	if urs.bof or urs.eof then
		aaas=0
	end if
	IF Request.cookies(echsys)("passwd")<>urs(db_User_Password) THEN
		aaas=0
	END IF
	urs.close
	set urs=nothing
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
<head> 
<title>留言本_<%=eChSys_Com%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/Wygkcn_Home.css" rel=stylesheet type=text/css>
<LINK href="CSS/Wygkcn_News.css" rel="stylesheet" type=text/css>
</head>
<body>
<!--内容部分开始-->
<div id="EC_Content">
<!--#include file="Top.asp"-->
<!--中间内容部分开始-->
<div id=zl_center>
<!--左边部分开始-->
<div class="zl_left float_left">
<div class="E_c_dl_dh">
<H3>交流互动</H3>
<DIV class=E_c_dl_name>
<ul>
<li><a href="wygkcn_LeadMail.asp">校长信箱</a></li>
<li><a href="Complain.asp">投诉举报</a></li>

<li><a href="wygkcn_GuestBook.asp" target="_blank">留言咨询</a></li>
</ul>
</div>
</div>
<div class="new_art lianmu_bg">
<H3>最新留言</H3>
<DIV class=new_art_list>
<ul class=list>
<%
	set rs_new=server.CreateObject("ADODB.RecordSet")
	rs_new.Source="select top 8 * from "& db_wygkcn_Review_Table &"  where passed=1 and (EC_ArticleID is NULL or EC_ArticleID < 1) Order by ReviewId DESC"	
	rs_new.Open rs_new.Source,conn,1,1
	If Not rs_new.eof then
    do until rs_new.Eof
	Title=trim(rs_new("Title"))
	DisplayTitle=mid(Title,1,26)
%>
<li>·<a href='wygkcn_GuestBook.asp?ReViewID=<%=rs_new("ReViewID")%>' target="_blank"><%=htmlencode(DisplayTitle)%>...</a></li>
<%
rs_new.MoveNext
loop
else
Response.write "<li>·暂无留言！</li>"				
End If
%>
</ul>
</div>
</div>

</div>
<!--左边部分结束-->

<!--右边部分开始-->
<div class="zl_right float_right">

<!--位置导航部分开始-->
<div class="position">
<img src="Images/lm_dot.gif" width="11" height="11">&nbsp;&nbsp;您的位置&nbsp;&nbsp;<a href="./" >首页</a> >> <a href="wygkcn_Conmunicate.asp">交流互动</a> >> <a href="wygkcn_GuestBook.asp">留言咨询</a> >>列表
</div>
<!--位置导航部分结束-->
<div id=hd_cnt>
<div class=tobook><a href="guestadd.asp" target="_blank"><img src="Images/tobook.gif" width="109" height="31" border="0"></a></div>
<div class="list_bookcnt">
<ul>
<%
set rs=server.createobject("adodb.recordset")
if not isempty(request("ReViewID")) and IsNumeric(request("ReViewID")) then
	sql="Select * From "& db_wygkcn_Review_Table &" where ReViewID="& CheckStr(trim(request("ReViewID"))) &" Order by ReviewId DESC"
else
	sql="Select * From "& db_wygkcn_Review_Table &" where EC_ArticleID is NULL or EC_ArticleID < 1 Order by istop DESC"
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
	if not isempty(request("ReViewID")) and IsNumeric(request("ReViewID")) then
		response.write "<br><p align=center><font color=red>找 不 到 你 指 定 的 留 言</font></p><br>"
	else
		response.write "<br><p align=center><font color=red>还 没 有 任 何 留 言</font></p><br>"
	end if
else
	totalPut=rs.recordcount
	if currentpage<1 then
		currentpage=1
	end if
	if (currentpage-1)*MaxPerPage>totalput then
		if (totalPut mod MaxPerPage)=0 then
			currentpage=totalPut \ MaxPerPage
		else
			currentpage=totalPut \ MaxPerPage + 1
		end if
	end if
	if currentPage=1 then
		showContent
		showpage totalput,MaxPerPage,"wygkcn_GuestBook.asp"
	else
		if (currentPage-1)*MaxPerPage<totalPut then
			rs.move (currentPage-1)*MaxPerPage
			dim bookmark
			bookmark=rs.bookmark
			showContent
			showpage totalput,MaxPerPage,"wygkcn_GuestBook.asp"
		else
			currentPage=1
			showContent
			showpage totalput,MaxPerPage,"wygkcn_GuestBook.asp"
		end if
	end if
	rs.close
end if
set rs=nothing
conn.close
set conn=nothing

sub showContent
do while not rs.eof
	author=rs("author")
	set urs=server.createobject("adodb.recordset")
	sql="select * from "& db_User_Table &" where "& db_User_Name &"='"&author&"'" 
	urs.open sql,ConnUser,1,3
	if not urs.bof or not urs.eof then
		if UserTableType = "Dvbbs" then
			photowidth=urs(db_User_FaceWidth)	''取注册用户论坛设定的图片片宽度
			photoheight=urs(db_User_FaceHeight)	''取注册用户论坛设定的图片高度 
		end if
		user=true			''是已注册用户
	else 
		user=notreg			''是非注册用户
	end if
	urs.close
	set urs=nothing
%>
<li>
<div class="book_bg booktitle"><span class=float_right>发表于：<%=rs("updatetime")%></span><%if rs("istop")=1 then%><font color="#FF0000">[置顶]</font><%end if%><a href='wygkcn_GuestBook.asp?ReViewID=<%=rs("ReViewID")%>' target="_blank">·<%=rs("title")%></a></div>
<div class="user_info float_left">
<img src="<%if trim(rs("Face"))<>"" then%><%=rs("Face")%><%else%>images/Image1.gif <%end if%>" border="0"
<%
if UserTableType = "Dvbbs" then '取用户头像,如为注册用户,则定义图片显示宽、高分辨率
    if user=true then
%>
width="<%=photowidth%>" height="<%=photoheight%>" 
	<%
	end if 
end if
%>
/> <br>
                        身份：<font color="red">
                          <%if rs("shengfen")<>"" then%>
                          <%=rs("shengfen")%>
                          <%else%>
                          保密
                          <%end if%>
                          </font> <br>
                        姓名：<%=rs("author")%> <br>
                        <%if rs("comefrom")<>"" then %>
                        来自：<%=rs("comefrom")%>
                        <%end if%>
                        <br>
                        <%if aaas=1 then %>
                        IP：<%=rs("reviewip")%>
                        <%end if%>
</div>
<div class="book_cnt float_right">
<div class=bookcnt>
<div class=manage_an>
<%if rs("email")<>"" then%>
<a href="mailto:<%=rs("email")%>"><img src="images/EMAIL.GIF" border="0" title='电子邮件'></a>
<%else%>
<img src="images/EMAIL.GIF" border="0">
<%end if%>
<%if rs("homepage")<>"" then%>
<a href="<%=rs("homepage")%>" target="_blank"><img src="images/homepage.gif" border="0" title='主页'></a>
<%else%>
<img src="images/homepage.gif" border="0">
<%end if%>
<% if rs("oicq")<>"" then%>
<a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("oicq")%>" ><img src="images/OICQ.gif" border="0"  title='显示QQ信息'></a>
<%else%>
<img src="images/OICQ.gif" border="0">
<%end if%>
<%if aaas=1 then %>
<a href="GuestEdit.asp?ReviewId=<%=rs("reviewid")%>"><img src="images/EDIT.GIF" border="0" title='编辑'></a> <a href="guestreply.asp?reviewid=<%=rs("reviewid")%>"><img src="images/reply.GIF" border="0" title='回复'></a> <a href='CheckReView.asp?ReviewID=<%=rs("ReviewID")%>&Guest=2'>
<%if rs("passed")=0 then%>
<img src="images/pass0.GIF" border="0" title='通过审核'>
<%else%>
<img src="images/pass1.GIF" border="0" title='取消审核'>
<%end if%>
</a> 
<a href='IsTop.asp?ReviewID=<%=rs("ReviewID")%>&Guest=2'>
<%if rs("IsTop")=0 then%>
<img src="images/istop0.GIF" border="0" title='设为置顶'>
<%else%>
<img src="images/istop1.GIF" border="0" title='取消置顶'>
<%end if%>
</a> 
<a href="guestdel.asp?reviewid=<%=rs("reviewid")%>"><img src="images/guestbook_delete.GIF" border="0"></a>
<%end if%>
<%if rs("EC_ArticleID")<>"" then%>
<a target="_blank" href="wygkcn_ShowArticle.asp?EC_ArticleID=<%=rs("EC_ArticleID")%>"><img src="images/reply1.GIF" width="0" height="0" border="0"></a>
<%end if%>
</div>
<div class=bookcontent>
<%
if rs("passed")=1 then
	if rs("EC_ArticleID")=-1 then	'-1 表示为悄悄话
		if aaas=1 then
			response.write rs("content")
		else
			response.write "<center><BR><font color=red>这是<B>悄悄话</B>,只有管理员才看的见...</font></center>"
		end if
	else
		response.write rs("content")
	end if
	else
		response.write "<center><BR><font color=red><B>留言未通过审核</B></font></center>"
		if aaas=1 then
			response.write "<font color=green>以下内容请审查核定：</font><br><br>"
			response.write rs("content")
		end if
end if
%>
<%if rs("reply")<>"" then %>
<hr />
<font color="#FF0000"><img src="Images/m_reply.gif" width="20" height="20" align="absmiddle">&nbsp;站长回复：</b><br>
<%=rs("reply")%></font>
<%end if%>
</div>
</div>
</div>
<div class=clear_float></div>
</li>
<%
a=a+1
if a>=MaxPerPage then exit do
rs.movenext
loop
end sub
%>
<%
function showpage(totalnumber,maxperpage,filename)
			dim n
			if totalnumber mod maxperpage=0 then
				n=totalnumber \ maxperpage
			else
				n=totalnumber \ maxperpage + 1
			end if
			response.write "<form method=post action="&filename&">"
			response.write "<div class=pages_menu>"
			if CurrentPage<2 then
				response.write "首页 上一页 "
			else
				response.write "<a href="&filename&"?page=1>首页</a> "
				response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
			end if
			if n-currentpage<1 then
				response.write "下一页 尾页"
			else
				response.write "<a href="&filename&"?page="&(CurrentPage+1)&">下一页</a> "
				response.write "<a href="&filename&"?page="&n&">尾页</a>"
			end if
				response.write "共"&totalnumber&"条留言 "&maxperpage&" 条留言/页 "
				response.write "转到：<input type='text' name='page' size=4 maxlength=10 value="&Currentpage&">"
				response.write "<input type='submit' value='Go' name='cndok'></div></form>"
			end function
%>

</li>
</ul>
</div>


</div>
</div>
<!--右边部分结束-->
<div class=clear_float></div><!--清除浮动属性-->
</div>
<!--中间内容部分结束-->
<!--#include file="bottom.asp"-->
</div>
<!--内容部分结束-->
</body>
</html>