<%
dim page,action,action_e
action = Request.QueryString("action")
action_e = Request.Form("action_e")
hx_Inf = split(hx_In,"|")
If Request.Form<>"" Then
	For Each hx_Post In Request.Form
		For hx_Xh=0 To Ubound(hx_Inf)
			If Instr(LCase(Request.Form(hx_Post)),hx_Inf(hx_Xh))<>0 Then
				Response.Write "<Script Language=JavaScript>alert('对不起，你发表的内容中包含系统禁止字符！');javascript :history.back();</Script>"
				Response.End
			End If
		Next
	Next
End If

Select Case action_e
Case ""
Case "Add_New"
if int(request("VerifyCode"))<>int(Session("GetCode")) then
     Response.Write("<script language=javascript>alert('请输入正确的认证码！');window.document.location.href='book.asp?action=Add_New';</script>") 
     Response.End 
else
     Call Add_New_Execute()
end if 
Case "Edit"
if session("adminlogin")<>sessionvar then
     Response.write "<script language = 'javascript'>alert('您还未登陆管理,无法进行编辑留言!');window.document.location.href='book.asp';</script>"
     Response.End
else
    Call Edit_Execute()
end if
End Select

Sub Main_Menu()
Response.Write "&nbsp;<a href='?action=Add_New'>·添加留言</a>&nbsp;<a href='?action=View_Words'>·查看留言</a>&nbsp;"
End Sub 

'=================================================
'过程名：content_book
'作  用：显示留言相关操作内容
'参  数：无
'=================================================
sub content_book()
    Select Case action		
	Case ""		
		Call View_Words()		
	Case "Add_New"
		Call Add_New()
	Case "Edit"
		Call Edit()
	Case "View_Words"	
		Call View_Words()	
	Case "Delete"
             if session("adminlogin")<>sessionvar then
                Response.write "<script language = 'javascript'>alert('您还未登陆管理,无法删除留言!');window.document.location.href='book.asp';</script>"
                Response.End
             else
		Call Delete()
		Call View_Words()
             end if				
    End Select
End Sub

'=================================================
'过程名：pattern_book
'作  用：留言模式
'参  数：无
'=================================================
Sub pattern_book()
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
Response.Write "<tr><td>" & vbCrLf
Response.Write "<div style=""LINE-HEIGHT: 180%"">" & vbCrLf
Response.Write "&nbsp;&nbsp;&nbsp;<font color=#FF0000>·</font><a href='book.asp?action=Add_New'>签写留言</a>&nbsp;<font color=#FF0000>·</font><a href='book.asp'>查看留言</a>" & vbCrLf
if Commentbook="会员" then
Response.Write "<br>&nbsp;&nbsp;&nbsp;<font color=#FF0000>·</font>留言模式：兜客模式" & vbCrLf
Else
Response.Write "<br>&nbsp;&nbsp;&nbsp;<font color=#FF0000>·</font>留言模式：游客模式" & vbCrLf
end if
if bookpass="yes" then
dim dsbook:dsbook=conn.execute("select count(*) from words where admin=2")(0)
Response.Write "<br>&nbsp;&nbsp;&nbsp;<font color=#FF0000>·</font>发表模式：审核发表" & vbCrLf
Response.Write "<br>&nbsp;&nbsp;&nbsp;<font color=#FF0000>·</font>待审留言：<font color=#FF0000>"&dsbook&" </font>条" & vbCrLf
Else
Response.Write "<br>&nbsp;&nbsp;&nbsp;<font color=#FF0000>·</font>发表模式：直接发表" & vbCrLf
end if
Response.Write "<br>" & vbCrLf
Response.Write "</div>" & vbCrLf
Response.Write "</td></tr>" & vbCrLf
Response.Write "</TABLE>" & vbCrLf
End Sub 

'=================================================
'过程名：Add_New_Execute
'作  用：留言发表
'参  数：无
'=================================================
Sub Add_New_Execute()
        server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
        server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
        if mid(server_v1,8,len(server_v2))<>server_v2 then
           Response.Write("<script language=javascript>alert('你提交的路径有误，禁止从站点外部提交数据请不要乱改参数！');this.location.href='index.asp';</script>") 
        response.end
        end if
	If Request.Form("zt")="" Then
	Response.Write "<script language=javascript>alert('主题不能为空！');javascript:history.back();</script>"
	Response.End
	End If
	If Len(Request.Form("zt"))>10 Then
	Response.Write "<script language=javascript>alert('你的主题太长了！');javascript:history.back();</script>"
	Response.End
	End If
	If Request.Form("name")="" Then
	Response.Write "<script language=javascript>alert('姓名不能为空！');javascript:history.back();</script>"
	Response.End
	End If
	If Len(Request.Form("name"))>12 Then
	Response.Write "<script language=javascript>alert('你的名字太长了！');javascript:history.back();</script>"
	Response.End
	End If
	If Request.Form("email")<>"" Then
	If instr(Request.Form("email"),"@")=0 or instr(Request.Form("email"),"@")=1 or instr(Request.Form("email"),"@")=len(email) then
	Response.Write "<script language=javascript>alert('电子信箱格式填写不正确！');javascript:history.back();</script>"
	Response.End
	End If
	End If
        If Request.Form("qq")<>"" Then
	If Len(Request.Form("qq"))<5 or Len(Request.Form("qq"))>10 or Not IsNumeric(Request.Form("qq")) then
	Response.Write "<script language=javascript>alert('QQ号码错误：\n\n① QQ号码只能是数字。\n\n② QQ号码不能低于4位数 \n\n③ QQ号码不能高于11位数\n\n④ 如果你没有QQ号码可以不填！');javascript:history.back();</script>"
	Response.End
	End If
	End If
	If Request.Form("words")="" Then
	Response.Write "<script language=javascript>alert('留言内容不能为空！');javascript:history.back();</script>"
	Response.End
	End If
        If Request.Form("words")<>"" Then
	If Len(Request.Form("words"))<4 or Len(Request.Form("words"))>255 then
	Response.Write "<script language=javascript>alert('留言内容错误提示：\n\n① 留言不得低于4个字！\n\n② 留言不得高于255个字，长篇大论请到论坛发表！');javascript:history.back();</script>"
	Response.End
	End If
	End If
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Sql="Select * From words"
	Rs.Open Sql,Conn,2,3
	Rs.AddNew
        if Request.Form("name")=webceo then
        Rs("name")=noceo
        elseif Request.Form("name")=ceopass then
        Rs("name")=webceo
        else
        Rs("name")=CheckStr(Jencode(Request.Form("name")))
        End If
        Rs("zt")=CheckStr(Request.Form("zt"))
	Rs("sex")=CheckStr(Request.Form("sex"))
        Rs("qq")=CheckStr(Request.Form("qq"))
        Rs("uc")=CheckStr(Request.Form("uc"))
       	Rs("city")=CheckStr(Request.Form("city"))
	Rs("web")=CheckStr(Request.Form("web"))
	Rs("email")=CheckStr(Request.Form("email"))
        if bookpass="yes" then
        Rs("admin")=2
        else
        Rs("admin")=CheckStr(Request.Form("admin"))
        End If
        Rs("title")=CheckStr(Request.Form("title"))
	Rs("words")=CheckStr(Jencode(Request.Form("words")))
	Rs("date")=Now()
        Rs("ip")=request.servervariables("remote_addr")
	Rs.Update
	Rs.Close
        Session("GetCode")=""
	Set Rs = Nothing
End Sub

'=================================================
'过程名：Edit_Execute
'作  用：留言编辑
'参  数：无
'=================================================
Sub Edit_Execute()
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Sql="Select * From words Where id="&int(Request.Form("id"))
	Rs.Open Sql,Conn,2,3
        Rs("zt") = CheckStr(Request.Form("zt"))
	Rs("words") = CheckStr(Request.Form("words"))
	Rs("reply") = CheckStr(Request.Form("reply"))
        Rs("admin") = CheckStr(Request.Form("admin"))
        Rs("redate") = Now()
	Rs.Update
	Rs.Close
	Set Rs=Nothing
End Sub

'=================================================
'过程名：Delete
'作  用：留言删除
'参  数：无
'=================================================
Sub Delete()
	Conn.Execute("Delete * From words Where id="&int(Request.QueryString("id")))
End Sub

'=================================================
'过程名：Add_New
'作  用：留言发表处理表单
'参  数：无
'=================================================
Sub Add_New()
Response.Write "<table width='90%' border='1' align='center' cellspacing='0' cellpadding='0' bordercolor='#f0f0f0' style='border-collapse: collapse'>" & vbCrLf
Response.Write "<form name=""form"" method=""post"" action=""book.asp"" onsubmit=""return checkBook();"">" & vbCrLf
if UserLogined=True then 
Response.Write "<tr>" & vbCrLf
Response.Write "<td width='80'>&nbsp;您的姓名：</td>" & vbCrLf
Response.Write "<td width='300'><input type=""hidden"" name=""name"" size=""20"" autocomplete=""off"" value="&Hx66_name&">"&Hx66_name&"&nbsp;&nbsp;" & vbCrLf
if Hx66_sex="男" then
Response.Write "<input type=""hidden"" name=""SEX"" value=""1"" checked>『帅哥』</td>" & vbCrLf
elseif Hx66_sex="女" then
Response.Write "<input type=""hidden"" name=""SEX"" value=""2"" checked>『美女』</td>" & vbCrLf
end if
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;电子邮箱：</td>" & vbCrLf
Response.Write "<td><input type=""hidden"" name=""email"" size=""20"" value="&Hx66_Email&">"&Hx66_Email&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;腾迅 Q Q：</td>" & vbCrLf
Response.Write "<td><input type=""hidden"" name=""qq"" size=""20"" value="&Hx66_QQ&">"&Hx66_QQ&" </td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;个人主页：</td>" & vbCrLf 
Response.Write "<td><input type=""hidden"" name=""web"" size=""20"" value="&Hx66_Homepage&">"&Hx66_Homepage&" </td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;你的头像：</td>" & vbCrLf 
Response.Write "<td>" & vbCrLf 
if Hx66_Photo<>"" then
Response.Write "<img src='"&Hx66_Photo&"' border=0 width=75 height=75><input type='hidden' name='uc' value='"&Hx66_Photo&"'>" & vbCrLf
else
Response.Write "<img src='img/face/01.gif' border=0 width=75 height=75><input type='hidden' name='uc' value='img/face/01.gif'>" & vbCrLf
end if
Response.Write "</td></tr>" & vbCrLf
else
Response.Write "<tr>" & vbCrLf
Response.Write "<td width='80'>&nbsp;您的姓名：</td>" & vbCrLf
Response.Write "<td width='300'><input type=""text"" name=""name"" maxlength=""7"" size=""20"" class='input' autocomplete=""off"">    <font color=red>*</font> ≤7个字符或7个汉字</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;您的性别：</td>" & vbCrLf
Response.Write "<td><input type=""radio"" name=""SEX"" value=""1"" checked>帅哥 <input type=""radio"" name=""SEX"" value=""2"">美女</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;电子邮箱：</td>" & vbCrLf
Response.Write "<td><input type=""text"" name=""email"" maxlength=""30"" size=""20"" class='input'></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;腾迅 QQ：</td>" & vbCrLf
Response.Write "<td><input type=""text"" name=""qq"" maxlength=""15"" size=""20"" class='input'> 填写你的QQ号码</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;个人主页：</td>" & vbCrLf
Response.Write "<td><input type=""text"" name=""web"" maxlength=""40"" size=""20"" class='input'> 网址必须包含http://</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr><td>&nbsp;选择头像：</td>" & vbCrLf
Response.Write "<td><select name=""uc"" size=""1"" id=""select5"" onChange=""document.all.idface.src=options[selectedIndex].value;""><option value='img/face/01.gif'>女生头像—1</option><option value=""img/face/02.gif"">女生头像—2</option><option value=""img/face/03.gif"">女生头像—3</option><option value=""img/face/04.gif"">女生头像—4</option><option value=""img/face/05.gif"">女生头像—5</option><option value=""img/face/06.gif"">女生头像—6</option><option value=""img/face/07.gif"">女生头像—7</option><option value=""img/face/08.gif"">女生头像—8</option><option value=""img/face/09.gif"">女生头像—9</option><option value=""img/face/10.gif"">女生头像—10</option><option value=""img/face/11.gif"">女生头像—11</option><option value=""img/face/12.gif"">女生头像—12</option><option value=""img/face/13.gif"">女生头像—13</option><option value=""img/face/14.gif"">女生头像—14</option><option value=""img/face/15.gif"">女生头像—15</option><option value=""img/face/16.gif"">女生头像—16</option><option value=""img/face/17.gif"">女生头像—17</option><option value=""img/face/18.gif"">女生头像—18</option><option value=""img/face/19.gif"">女生头像—19</option><option value=""img/face/20.gif"">女生头像—20</option><option value=""img/face/21.gif"">女生头像—21</option><option value=""img/face/22.gif"">女生头像—22</option><option value=""img/face/23.gif"">女生头像—23</option><option value=""img/face/24.gif"">女生头像—24</option><option value=""img/face/25.gif"">女生头像—25</option><option value=""img/face/26.gif"">女生头像—26</option><option value=""img/face/27.gif"">女生头像—27</option><option value=""img/face/28.gif"">女生头像—28</option><option value=""img/face/29.gif"">女生头像—29</option><option value=""img/face/30.gif"">女生头像—30</option><option value=""img/face/31.gif"">男生头像—1</option><option value=""img/face/32.gif"">男生头像—2</option><option value=""img/face/33.gif"">男生头像—3</option><option value=""img/face/34.gif"">男生头像—4</option><option value=""img/face/35.gif"">男生头像—5</option><option value=""img/face/36.gif"">男生头像—6</option><option value=""img/face/37.gif"">男生头像—7</option><option value=""img/face/38.gif"">男生头像—8</option><option value=""img/face/39.gif"">男生头像—9</option><option value=""img/face/40.gif"">男生头像—10</option><option value=""img/face/41.gif"">男生头像—11</option><option value=""img/face/42.gif"">男生头像—12</option><option value=""img/face/43.gif"">男生头像—13</option><option value=""img/face/44.gif"">男生头像—14</option><option value=""img/face/45.gif"">男生头像—15</option><option value=""img/face/46.gif"">男生头像—16</option><option value=""img/face/47.gif"">男生头像—17</option><option value=""img/face/48.gif"">男生头像—18</option><option value=""img/face/49.gif"">男生头像—19</option><option value=""img/face/50.gif"">男生头像—20</option><option value=""img/face/51.gif"">男生头像—21</option><option value=""img/face/52.gif"">男生头像—22</option><option value=""img/face/53.gif"">男生头像—23</option><option value=""img/face/54.gif"">男生头像—24</option><option value=""img/face/55.gif"">男生头像—25</option><option value=""img/face/56.gif"">男生头像—26</option><option value=""img/face/57.gif"">男生头像—27</option><option value=""img/face/58.gif"">男生头像—28</option><option value=""img/face/59.gif"">男生头像—29</option><option value=""img/face/60.gif"">男生头像—30</option></select>&nbsp;&nbsp;&nbsp;&nbsp;<img src=""img/face/09.gif"" width=""90"" height=""90"" id=idface></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
end if
Response.Write "<tr>" & vbCrLf
Response.Write "<td>&nbsp;发表主题：</td>" & vbCrLf
Response.Write "<td><input type=""text"" name=""zt"" maxlength=""10"" size=""40"" class='input' autocomplete=""off"">   <font color=red>*</font> ≤10个字符或10个汉字</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr><td>&nbsp;类型选择：</td>" & vbCrLf
Response.Write "<td><input type=""radio"" name=""title"" value=""1"" checked><font color=#0000FF>留言</font> <input type=""radio"" name=""title"" value=""2""><font color=#FF00FF>建议" & vbCrLf
Response.Write "" & vbCrLf
Response.Write "</font> <input type=""radio"" name=""title"" value=""3""><font color=#FF7F50>报错</font> <input type=""radio"" name=""title"" value=""4""><font color=#228B22>连接</font>" & vbCrLf
Response.Write "" & vbCrLf
Response.Write "<input type=""radio"" name=""title"" value=""5""><font color=#1E90FF>其它</font></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td valign=""top"">&nbsp;留言内容： <br><font color=red>&nbsp;*支持UBB</font><br><br>&nbsp;字数：<br>&nbsp;<input type='text' value='0' id='wordsLen' size='2' style='border-width:0;background:transparent;'><font title='等于或小于255个字！'>≤255</font></td>" & vbCrLf
Response.Write "<td valign=""bottom"">" & vbCrLf
if Commentbook="会员" and UserLogined<>True then
Response.Write "<textarea name=""words"" cols=""65"" rows=""12"" class='input' onkeydown=""bookshowLen(this)"" onkeyup=""bookshowLen(this)"">本留言本开启了会员发表模式，你还没有登陆呢，请先登陆！</textarea>" & vbCrLf
Else
Response.Write "<textarea name=""words"" cols=""65"" rows=""12"" class='input' onkeydown=""bookshowLen(this)"" onkeyup=""bookshowLen(this)""></textarea>" & vbCrLf
end if
Response.Write "</td></tr>" & vbCrLf
if bookpass<>"yes" then
Response.Write "<tr>" & vbCrLf
Response.Write "<td valign=""middle"">&nbsp;是否隐藏：</td>" & vbCrLf
Response.Write "<td valign=""top"">" & vbCrLf
Response.Write "<input type=""radio"" name=""admin"" value=""0"" checked> 否 <input type=""radio"" name=""admin"" value=""1""> 是&nbsp;&nbsp;<font color=#009900>*</font> 选择隐藏后，此" & vbCrLf
Response.Write "" & vbCrLf
Response.Write "留言只有管理员可以看到。</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
End If
Response.Write "<tr>" & vbCrLf
Response.Write "<td valign=""middle"">&nbsp;认证码：</td>" & vbCrLf
Response.Write "<td valign=""top"">" & vbCrLf
Response.Write "<input name=""VerifyCode"" type=""text"" size=""10"" class='input'> &nbsp;<img src=""inc/lyCode.asp""></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td align=""center""  height=""40"" colspan=""2"">" & vbCrLf
Response.Write "<input type=""hidden"" name=""action_e"" value=""Add_New""> <input type=""submit"" name=""Submit"" value=""提交"" onmouseover=""this.className='boton'""" & vbCrLf
if Commentbook="会员" and UserLogined<>True then
Response.Write "onmouseout=""this.className='botoff'"" class=""botoff"" disabled>" & vbCrLf
Else
Response.Write "onmouseout=""this.className='botoff'"" class=""botoff"">" & vbCrLf
end if
Response.Write "<input type=""reset"" name=""Submit2"" value=""重写"" onmouseover=""this.className='boton'"" onmouseout=""this.className='botoff'"" class=""botoff"">" & vbCrLf
Response.Write "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "</form>" & vbCrLf
Response.Write "</table>" & vbCrLf
End Sub

'=================================================
'过程名：Edit
'作  用：留言编辑处理表单
'参  数：无
'=================================================
Sub Edit()
if session("adminlogin")<>sessionvar then
Response.write "<script language = 'javascript'>alert('您还未登陆管理,无法编辑留言!');window.document.location.href='book.asp';</script>"
end if	
Set Rs = Server.CreateObject("ADODB.RecordSet")
Sql="Select * From words Where id="&int(Request.QueryString("id"))
Rs.Open Sql,Conn,1,1
Response.Write "<table width='100%' border='1' align='center' cellspacing='0' cellpadding='5' bordercolor='#f0f0f0' style='border-collapse: collapse'>" & vbCrLf
Response.Write "<form name=""reply"" method=""post"" action=""?"">" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write " <TD align=""center"" height='50'>编辑、回复来客留言主题</TD>" & vbCrLf
Response.Write "</tr><tr>" & vbCrLf
Response.Write "<td align=""center"">主题：<input type='text' name='zt' maxlength='12' size='55' value="&Rs("zt")&"></td>" & vbCrLf
Response.Write "</tr><tr>" & vbCrLf
Response.Write " <TD align=""center"">来客、会员留言内容</TD>" & vbCrLf
Response.Write "</tr><tr>" & vbCrLf
Response.Write "<td align=""center""><textarea name=""words"" cols=""60"" rows=""7"">"&Rs("words")&"</textarea></td>" & vbCrLf
Response.Write "</tr><tr>" & vbCrLf
Response.Write " <TD align=""center"">管理员回复内容</TD></tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td align=""center""><textarea name=""reply"" cols=""60"" rows=""6"">"&Rs("reply")&"</textarea></td>" & vbCrLf
Response.Write "</tr><tr>" & vbCrLf
Response.Write "<td align=""center"" height='28'>是否隐藏：" & vbCrLf
Response.Write "<input type=""radio"" name=""admin"" value=""0"""
If Rs("admin")="0" Then
Response.Write "checked" & vbCrLf
end if
Response.Write "> 否" & vbCrLf
Response.Write "<input type=""radio"" name=""admin"" value=""1"""
If Rs("admin")="1" Then
Response.Write "checked" & vbCrLf
end if
Response.Write "> 是"
Response.Write "&nbsp;&nbsp;<input type=""radio"" name=""admin"" value=""2"""
If Rs("admin")="2" Then
Response.Write "checked" & vbCrLf
end if
Response.Write "> 待审核"
Response.Write "&nbsp;&nbsp;<font color=#009900>*</font> 选择隐藏后，此留言只有管理员可以看到。</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr align=""center""><td colspan=""2""><input type=""hidden"" name=""action_e"" value=""Edit"">" & vbCrLf
Response.Write "<input type=""hidden"" name=""id"" value="""&Request.QueryString("id")&""">" & vbCrLf
Response.Write "<input type=""submit"" name=""Submit"" value=""确定"" id=""Submit"" onmouseover=""this.className='boton'"" onmouseout=""this.className='botoff'"" class=""botoff""></td></tr>" & vbCrLf
Response.Write "</form>" & vbCrLf
Response.Write "</table>" & vbCrLf
End Sub 

'=================================================
'过程名：View_Words
'作  用：显示带分页功能留言列表
'参  数：无
'=================================================
Sub View_Words()
Dim CurPage,Url_Add
Url_Add="?"
If Request.QueryString("Page")<>"" Then
   Curpage=Request.QueryString("Page")
   If IsInteger(Curpage)=False Then Curpage=1
Else
   Curpage=1
End If
if request("keyword")<>"" then
  if instr(request("keyword"),"'")>0 then
    Response.Write "<script language=javascript>alert('搜索参数非法。');javascript:history.back();</script>"
    response.end
  end if
end if
Set Rs = Server.CreateObject("ADODB.RecordSet")
if request("keyword")<>"" and (request("select")="words" or request("select")="name" or request("select")="reply") then
   sql="select * from words where "&request("select")&" like '%"&Jencode(checkspace(request("keyword")))&"%'order by id DESC"
   Url_Add=Url_Add&"select="&request("select")&"&keyword="&Server.URLEncode(request("keyword"))&"&"
else
   Sql="Select * From words Order By id Desc"
end if
Rs.Open Sql,Conn,1,1
Response.Write "<table width='100%' border='1' align='center' cellspacing='0' cellpadding='0' bordercolor='#F0F0F0' style='border-collapse: collapse'>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td height=30 colSpan=2><FONT color=#b70000>&nbsp;<B>·</B></FONT>"
if request("keyword")<>"" then
Response.Write "共搜索到"
else
Response.Write "当前共有"
end if
Response.Write "<span>"&rs.recordcount&"</span>个留言</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
if not rs.eof then
   Dim Hx_Nums,MultiPages,i
   Hxperpage=8
   Rs.PageSize=Hxperpage
   Rs.AbsolutePage=CurPage
   Hx_Nums=Rs.RecordCount
   MultiPages="<tr><td colspan=""3"" height='28' align=""center"">"&MultiPage(Hx_Nums,Hxperpage,CurPage,Url_Add)&"</td></tr>"
Do Until Rs.EOF OR i=Hxperpage
NO=Hx_Nums-i-(Hxperpage*Curpage)+Hxperpage
Response.Write "<tr>"
Response.Write "<td rowspan=2 width=120 valign=top align=center><a href='?select=name&keyword="&Rs("name")&"' title='查找["&Rs("name")&"]发表的所有留言'><font color=#ff6600><b>"&Rs("name")&"</b></font></a><br>"
If Rs("uc")<>"" Then
Response.Write "<img align=absBottom border=0 src='"&Rs("uc")&"' width='100'>"
elseif Rs("sex")="1" then
Response.Write "<img src=img/face/09.gif>"
elseif Rs("sex")="2" then
Response.Write "<img src=img/face/01.gif>"
End If
Response.Write "</td>"
Response.Write "<td height=22>"
Response.Write "<table border=0 cellpadding=3 cellspacing=0 width='100%'><tbody>"
Response.Write "<tr>"
Response.Write "<td width='80%'>第"&NO&"楼·<b>"&Rs("zt")&"</b> "&Rs("date")&"</td>"
Response.Write "<td align=right width='20%'>"
If Rs("city")<>"" Then
Response.Write "<img align=absBottom title='"&Rs("name")&"来自"&Rs("city")&"' border=0 height=11 src='img/city.gif' width=11>&nbsp;"
End If
If Rs("email")<>"" Then
Response.Write "<a href='mailto:"&Rs("email")&"'><img align=absBottom border=0 height=11 src='img/mail.gif' width=11 title='给"&Rs("name")&"写信'></a>&nbsp;"
End If
If Rs("qq")<>"" Then
Response.Write "<img align=absBottom title='"&Rs("name")&"的QQ号码是"&Rs("qq")&"' border=0 height=11 src='img/qq.gif' width=11>&nbsp;"
End If
If Rs("web")<>"" Then
Response.Write "<a href='"&Rs("web")&"' target='_blank'><img align=absBottom border=0 height=11 src='img/web.gif' width=11 title='去"&Rs("name")&"的主页看看'></a>&nbsp;"
End If
Response.Write "<img align=absBottom title='"&Rs("name")&"的IP地址为"&Rs("ip")&"' height=11 src='img/ip.gif' width=11>&nbsp;"
If session("adminlogin")=sessionvar Then 
Response.Write "<a href='?action=Delete&id="&Rs("id")&"'><img align=absBottom border=0 title='【删除】' height=11 src='img/Delete.gif' width=11></a>&nbsp;<a href='?action=Edit&id="&Rs("id")&"'><img align=absBottom border=0 title='【编辑回复】' height=11 src='img/edit.gif' width=11></a>&nbsp;"
End if
Response.Write "</td></tr></tbody></table>"
Response.Write "</td></tr>"
Response.Write "<tr><td height=80 valign=top>"
Response.Write "<table border=0 cellpadding=0 cellspacing=2 width='100%' height='100%' style='table-layout:fixed; word-break:break-all; line-height:150%'><tbody>"
Response.Write "<tr><td><img src='img/dot6.gif' width='16' height='15'>"
If Rs("admin")="0" Then
Response.Write "["
if Rs("title")="1" then
Response.Write "<font color=#0000FF>留言</font>"
elseif Rs("title")="2" then
Response.Write "<font color=#FF00FF>建议</font>"
elseif Rs("title")="3" then
Response.Write "<font color=#FF7F50>报错</font>"
elseif Rs("title")="4" then
Response.Write "<font color=#228B22>连接</font>"
elseif Rs("title")="5" then
Response.Write "<font color=#1E90FF>其它</font>"
End If
Response.Write "]"&Ubb(unHtml(Rs("words")))&""
elseif session("adminlogin")=sessionvar Then 
Response.Write "<center><font color=#1E90FF>─────≡ 以下为管理员可见内容 ≡─────</font></center>["
if Rs("title")="1" then
Response.Write "<font color=#0000FF>留言</font>"
elseif Rs("title")="2" then
Response.Write "<font color=#FF00FF>建议</font>"
elseif Rs("title")="3" then
Response.Write "<font color=#FF7F50>报错</font>"
elseif Rs("title")="4" then
Response.Write "<font color=#228B22>连接</font>"
elseif Rs("title")="5" then
Response.Write "<font color=#1E90FF>其它</font>"
End If
Response.Write "]"&Ubb(unHtml(Rs("words")))&""
elseIf Rs("admin")="1" Then
Response.Write "<center><font color=#1E90FF>─────≡ 秘密留言！管理员可见 ≡─────</font></center>"
else
Response.Write "<center><font color=#1E90FF>─────≡ 待审核留言 ≡─────</font></center>"
End If
Response.Write "</td></tr>"
If Rs("reply")<>"" Then
Response.Write "<tr><td valign='bottom'><img src='img/dot5.gif' width='16' height='15'><font color=red>版主回复：</font><font color=green>"&Ubb(unHtml(Rs("reply")))&"</font>("&year(rs("redate"))&"-"&month(rs("redate"))&"-"&day(rs("redate"))&")</td></tr>"
Response.Write "<tr><td align=right height='20'><img src='img/pen.gif'></td></tr>"
End If
Response.Write "</table></td></tr>"
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
Response.Write "<tr><td align=middle height='80' colSpan=2>"
if request("keyword")<>"" then
Response.Write "没有找到包含[<b><font color=red>"&request("keyword")&"</font></b>]的留言！"
else
Response.Write "没有任何留言，欢迎您成为本站第一个留言者！"
end if
Response.Write "</td></tr>"
end if
end if
Response.Write(MultiPages)
Response.Write "</table>" & vbCrLf
rs.close
set rs=nothing
end sub

'=================================================
'过程名：search_book
'作  用：显示留言搜索表单
'参  数：无
'=================================================
sub search_book()
Response.Write "<form name=""form2"" method=""post"" action=""book.asp""><div align=center><input type=""radio"" name=""select"" value=""name"" checked>作者&nbsp;<input type=""radio"" name=""select"" value=""words"">内容&nbsp;<input type=""radio"" name=""select"" value=""reply"">回复<br><input type='text' name='keyword'  size='16' value='搜索关键字' maxlength='50' onfocus=""this.value=''"" class=""input"">&nbsp;<input type='submit' name='search'  value='搜索' onmouseover=""this.className='boton'"" onmouseout=""this.className='botoff'"">" & vbCrLf
Response.Write "</div></form>" & vbCrLf
end sub
%>

<%
'=================================================
'过程名：unHtml,ubb,isInteger,Convert,AutoURL
'作  用：留言UBB处理
'参  数：无
'=================================================
function unHtml(content)
unHtml=content
if content <> "" then
unHtml=replace(unHtml,"<","&lt;")
unHtml=replace(unHtml,">","&gt;")
unHtml=replace(unHtml,chr(34),"&quot;")
unHtml=replace(unHtml,chr(13),"<br>")
unHtml=replace(unHtml,chr(32),"&nbsp;")
end if
end function

function ubb(content)
ubb=content
    nowtime=now()
    UBB=Convert(ubb,"code")
    UBB=Convert(ubb,"html")
    UBB=Convert(ubb,"url")
    UBB=Convert(ubb,"color")
    UBB=Convert(ubb,"font")
    UBB=Convert(ubb,"size")
    UBB=Convert(ubb,"quote")
    UBB=Convert(ubb,"email")
    UBB=Convert(ubb,"img")
    UBB=Convert(ubb,"swf")

    UBB=AutoURL(ubb)
    ubb=replace(ubb,"[b]","<b>",1,-1,1)
    ubb=replace(ubb,"[/b]","</b>",1,-1,1)
    ubb=replace(ubb,"[i]","<i>",1,-1,1)
    ubb=replace(ubb,"[/i]","</i>",1,-1,1)
    ubb=replace(ubb,"[u]","<u>",1,-1,1)
    ubb=replace(ubb,"[/u]","</u>",1,-1,1)
    ubb=replace(ubb,"[blue]","<font color='#000099'>",1,-1,1)
    ubb=replace(ubb,"[/blue]","</font>",1,-1,1)
    ubb=replace(ubb,"[red]","<font color='#990000'>",1,-1,1)
    ubb=replace(ubb,"[/red]","</font>",1,-1,1)
    for i=1 to 28
    ubb=replace(ubb,"{:em"&i&"}","<IMG SRC=emot/emotface/em"&i&".gif></img>",1,6,1)
    ubb=replace(ubb,"{:em"&i&"}","",1,-1,1)
    next
    ubb=replace(ubb,"["&chr(176),"[",1,-1,1)
    ubb=replace(ubb,chr(176)&"]","]",1,-1,1)
    ubb=replace(ubb,"/"&chr(176),"/",1,-1,1)
end function

function Convert(ubb,CovT)
cText=ubb
startubb=1
do while Covt="url" or Covt="color" or Covt="font" or Covt="size"
startubb=instr(startubb,cText,"["&CovT&"=",1)
if startubb=0 then exit do
endubb=instr(startubb,cText,"]",1)
if endubb=0 then exit do
Lcovt=Covt
startubb=startubb+len(lCovT)+2
text=mid(cText,startubb,endubb-startubb)
codetext=replace(text,"[","["&chr(176),1,-1,1)
codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)
codetext=replace(codetext,"/","/"&chr(176),1,-1,1)
select case CovT
    case "color"
	cText=replace(cText,"[color="&text&"]","<font color='"&text&"'>",1,1,1)
	cText=replace(cText,"[/color]","</font>",1,1,1)
    case "font"
	cText=replace(cText,"[font="&text&"]","<font face='"&text&"'>",1,1,1)
	cText=replace(cText,"[/font]","</font>",1,1,1)
    case "size"
	if IsNumeric(text) then
	if text>6 then text=6
	if text<1 then text=1
	cText=replace(cText,"[size="&text&"]","<font size='"&text&"'>",1,1,1)
	cText=replace(cText,"[/size]","</font>",1,1,1)
	end if
    case "url"
	cText=replace(cText,"[url="&text&"]","<a href='"&codetext&"' target=_blank>",1,1,1)
	cText=replace(cText,"[/url]","</a>",1,1,1)
    case "email"
	cText=replace(cText,"["&CovT&"="&text&"]","<a href=mailto:"&text&">",1,1,1)
	cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)
end select
loop
startubb=1
do
startubb=instr(startubb,cText,"["&CovT&"]",1)
if startubb=0 then exit do
endubb=instr(startubb,cText,"[/"&CovT&"]",1)
if endubb=0 then exit do
Lcovt=Covt
startubb=startubb+len(lCovT)+2
text=mid(cText,startubb,endubb-startubb)
codetext=replace(text,"[","["&chr(176),1,-1,1)
codetext=replace(codetext,"]",chr(176)&"]",1,-1,1)
codetext=replace(codetext,"/","/"&chr(176),1,-1,1)
select case CovT
    case "url"
	cText=replace(cText,"["&CovT&"]"&text,"<a href='"&codetext&"' target=_blank>"&codetext,1,1,1)
	cText=replace(cText,"<a href='"&codetext&"' target=_blank>"&codetext&"[/"&CovT&"]","<a href="&codetext&" target=_blank>"&codetext&"</a>",1,1,1)
    case "email"
	cText=replace(cText,"["&CovT&"]","<a href=mailto:"&text&">",1,1,1)
	cText=replace(cText,"[/"&CovT&"]","</a>",1,1,1)
    case "html"
	codetext=replace(codetext,"<br>",chr(13),1,-1,1)
	codetext=replace(codetext,"&nbsp;",chr(32),1,-1,1)
	Randomize
	rid="temp"&Int(100000 * Rnd)
	cText=replace(cText,"[html]"&text,"代码片断如下：<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext,1,1,1)
	cText=replace(cText,"代码片断如下：<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"[/html]","代码片断如下：<TEXTAREA id="&rid&" rows=15 style='width:100%' class='bk'>"&codetext&"</TEXTAREA><INPUT onclick=runEx('"&rid&"') type=button value=运行此段代码 name=Button1 class='Tips_bo'> <INPUT onclick=JM_cc('"&rid&"') type=button value=复制到我的剪贴板 name=Button2 class='Tips_bo'>",1,1,1)
    case "img"
	cText=replace(cText,"[img]"&text,"<a href="&chr(34)&"about:<img src="&codetext&" border=0>"&chr(34)&" target=_blank><img src="&codetext,1,1,1)
	cText=replace(cText,"[/img]"," vspace=2 hspace=2 border=0 alt=::点击图片在新窗口中打开::></a>",1,1,1)
    case "code"
	cText=replace(cText,"[code]"&text,"以下内容为程序代码<hr noshade>"&codetext,1,1,1)
	cText=replace(cText,"以下内容为程序代码<hr noshade>"&codetext&"[/code]","以下内容为程序代码<hr noshade>"&codetext&"<hr noshade>",1,1,1)
    case "quote"
	atext=replace(text,"[img]","",1,-1,1)
	atext=replace(atext,"[/img]","",1,-1,1)
	atext=replace(atext,"[swf]","",1,-1,1)
	atext=replace(atext,"[/swf]","",1,-1,1)
	atext=replace(atext,"[html]","",1,-1,1)
	atext=replace(atext,"[/html]","",1,-1,1)
	atext=SplitWords(atext,350)
	atext=replace(atext,chr(32),"&nbsp;",1,-1,1)
	cText=replace(cText,"[quote]"&text,"<blockquote><hr noshade>"&atext,1,1,1)
	cText=replace(cText,"<blockquote><hr noshade>"&atext&"[/quote]","<blockquote><hr noshade>"&atext&"<hr noshade></blockquote>",1,1,1)
    case "swf"
	cText=replace(cText,"[swf]"&text,"影片地址:<br>"&text&"<br><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>",1,1,1)
	cText=replace(cText,"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"[/swf]","<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='500' height='500'><param name=movie value='"&codetext&"'><param name=quality value=high><embed src='"&codetext&"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='500' height='500'>"&"</embed></object>",1,1,1)
end select
loop
Convert=cText
end function
function AutoURL(ubb)
cText=ubb
startubb=1
do
startubb=1
endubb_a=0
endubb_b=0
endubb=0
startubb=instr(startubb,cText,"http://",1)
if startubb=0 then exit do
endubb_b=instr(startubb,cText,"<",1)
endubb_a=instr(startubb,cText,"&nbsp;",1)
endubb=endubb_a
if endubb=0 then
endubb=endubb_b
end if
if endubb_b<endubb and endubb_b>0 then
endubb=endubb_b
end if
if endubb=0 then
lenc=ctext
endubb=len(lenc)+1
end if
if startubb>endubb then exit do
text=mid(cText,startubb,endubb-startubb)
codetext=text
urllink="<a href='"&codetext&"' target=_blank>"&codetext&"</a> "
urllink=replace(urllink,"/","/"&chr(176),1,-1,1)
cText=replace(cText,text,urllink,1,1,1)
loop
AutoURL=cText
end function
%>

