<!-- #include file="include/config_other.asp" -->
<!-- #include file="include/time_lock.asp" -->
<!-- #include file="include/jk_ubb.asp" -->
<!-- #include file="include/val_code.asp" -->
<!-- #include file="include/conn.asp" -->
<%
dim nummer,rssum,sumrs,page,viewpage,thepages,pageurl,id,nname,sex,url,whe,topic,re_word,hidden,h_view,qq,email,ipp
pageurl="?":nummer=objv7.web_var(web_num,4):h_view="no"
index_url="gbook"
if action="write" then
  tit="签写留言"
  tit_fir=objv7.format_menu(web_menu,index_url)
else
  tit=objv7.format_menu(web_menu,index_url)
  tit_fir=""
end if

call web_head(0,0,0,0,0)
'------------------------------------left----------------------------------
call format_login()
call gbook_left()
'----------------------------------left end--------------------------------
call web_center(0)
'-----------------------------------center---------------------------------
response.write kong&admin_bar(tit,1,"100%")

if action="write" then
  if objv7.post_chk()<>"yes" then
    call close_conn()
    call cookies_type("post")
  end if
  call time_lock()
  call gbook_write()
else
  call gbook_main()
end if

response.write admin_bar("",2,"100%")&kong
'---------------------------------center end-------------------------------
call web_end(0)

sub gbook_left()
  dim temp1
  temp1=vbcrlf&"<table border=0 width='96%' cellspacing=0 cellpadding=2 align=center>" & _
	vbcrlf&"<tr><td height=5></td></tr>" & _
	vbcrlf&"<tr><td height=30 align=center><a href='gbook.asp?action=write'>签写我的留言</a></td></tr>" & _
	vbcrlf&"<tr><td class=time_3 align=center><b>关于"&tit&"</b></td></tr>" & _
	vbcrlf&"<tr><td align=center>任何人都可以在这里留言<br>只有注册并登陆后才可以看到其它留言者的系统信息</td></tr>" & _
	vbcrlf&"<tr><td align=center>系统支持："&replace(objv7.web_var(web_error,3),"<br>","，")&"</td></tr>" & _
	vbcrlf&"</table>"
  response.write kong&vbcrlf&main_bar(0,"签写留言说明",temp1,0,"100%","")&left_action("jt13",4)
end sub

sub gbook_main()
  sql="select * from gb_data order by id desc"
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,1,1
  if rs.eof and rs.bof then
    rs.close:set rs=nothing
    call close_conn()
    response.redirect "gbook.asp?action=write"
    response.end
  end if
  rssum=rs.recordcount
  call format_pagecute()
%>
<table width='99%' border=0 align=center cellpadding=2 cellspacing=1>
<tr class=tdbg-dark><td height=25 align=center>
现有<font class=time><%response.write rssum%></font>条留言，每页<font class=time><%response.write nummer%></font>条，页次<font class=time><%response.write viewpage%></font>/<font class=time><%response.write thepages%></font>&nbsp;
分页：<%response.write objv7.jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
</td></tr>
</table>
<%
  if login_mode=objv7.format_power2(user_power,1,1) and login_username=objv7.web_var(web_config,3) then h_view="yes"
  response.write kong
  
  if int(viewpage)>1 then
    rs.move (viewpage-1)*nummer
  end if
  for i=1 to nummer
    if rs.eof then exit for
    response.write gbook_view()
    rs.movenext
  next
  rs.close:set rs=nothing
end sub

function gbook_view()
  id=rs("id")
  nname=rs("nname")
  sex=rs("sex")
  if sex="girl" then
    sex="女孩"
  else
    sex="男孩"
  end if
  qq=rs("qq")
  email=rs("email")
  url=rs("url")
  whe=rs("whe")
  topic=rs("topic")
  ipp=rs("ip")
  re_word=code_jk(rs("re_word"))
  hidden=rs("hidden")
%>
<table width='99%' border=0 align=center cellpadding=2 cellspacing=1>
<tr class=tdbg-tree><td>&nbsp;<b><font class=time>No.<%response.write rssum-(i+(viewpage-1)*nummer)+1%></font>&nbsp;主题：<font title='<%response.write objv7.code_html(topic,1,0)%>'><%response.write objv7.code_html(topic,1,36)%></font></b></td></tr>
<tr><td>
<table border=0 width='100%' cellspacing=0 cellpadding=0>
  <tr>
    <td align=center>
      <table border=0 width='100%' cellspacing=2 cellpadding=0 height='100%'>
        <tr align=center valign=top>
          <td width=120>
            <table border=0 width='100%'>
              <tr><td align=center><%=nname%></td></tr>
              <tr><td align=center><img src='images/face/<%=rs("face")%>.gif' title='<%=nname&" 是 "&sex%>' border=0></td></tr>
              <tr><td align=center><% if whe<>"nuller" then response.write "来自：" & objv7.code_html(whe,1,0)%></td></tr>
            </table>
          </td>
          <td width=1 class=footline></td>
          <td width=* height='100%'>
            <table border=0 width='100%' height='100%' cellspacing=0 cellpadding=0>
            <tr><td colspan=2 valign=top>
              <table border=0 width='100%' cellspacing=4 cellpadding=2><tr><td>
<%
if hidden=true and h_view="no" then
  response.write "<br><br><center><font class=time>^-^ 此条留言只有管理员才可以看哦 ^-^</font></center><br><br>"
else
  response.write "<img src='images/icon/"&rs("icon")&".gif' border=0>&nbsp;"
  if hidden=true then
    response.write "<font class=time>[隐藏]</font>&nbsp;"
  end if
  response.write code_jk(rs("word"))
end if
%></td></tr></table>
<%
if len(re_word)>0 then
  response.write vbcrlf & "<table cellspacing=1 cellpadding=2 align=center width='95%'><tr class=tdbg-dark><td>" & _
		 vbcrlf & "<font class=time>版主回复于：</font>" & rs("re_tim") & "<br>" & _
		 vbcrlf & "<img src='images/icon/" & rs("re_icon") & ".gif' border=0>&nbsp;" & re_word & _
		 vbcrlf & "</td></tr></table>"
end if
%>
</td></tr>
<tr><td height=5></td></tr>
<tr><td height=1 colspan=2 class=footline></td></tr>
<tr height=20>
<td width='60%'>&nbsp;<img src='images/small/tim.gif' align=absmiddle title='签写时间' border=0>　<%response.write objv7.time_type(rs("tim"),88)%></td>
<td width='40%' align=right><%
if qq<>"nuller" then
  response.write "<a href='http://search.tencent.com/cgi-bin/friend/user_show_info?ln="&qq&"' target=_blank><img src='images/small/qq.gif' title='"&nname&" 的QQ是："&qq&"' border=0></a>&nbsp;"
end if
if var_null(url)<>"" and url<>"nuller" and url<>"http://" then
  response.write "<a href='"&url&"' target=_blank><img src='images/small/url.gif' title='访问 "&nname&" 的主页' border=0></a>&nbsp;"
end if
if email<>"nuller" then
  response.write "<a href='mailto:"&email&"'><img src='images/small/email.gif' title='给 "&nname&" 发电子邮件' border=0></a>&nbsp;"
end if
if login_username<>"" and login_password<>"" and login_mode<>"" then
  response.write objv7.ip_types(ipp,nname,1) & "&nbsp;" & _
		 "<img src='images/small/sys.gif' align=absMiddle title='" & objv7.view_sys(rs("sys")) & "' border=0>"
  if login_mode="admin" then
    response.write "&nbsp;<a href='gbook_action.asp?action=reply&id=" & rs("id") & "&page=" & viewpage & "'><img src='images/small/reply.gif' alt='回复这条留言' border=0></a>&nbsp;" & _
		   "<a href='gbook_action.asp?action=delete&id=" & rs("id") & "&page=" & viewpage & "'><img src='images/small/del.gif' alt='删除这条留言' border=0></a>"
  end if
end if
%></td>
</tr>
</table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
 </table>
</td></tr>
</table>
<%
  response.write kong
end function

sub gbook_write()
  response.write vbcrlf&"<table border=0 width='100%'><tr><td align=center height=300>"
  if request.form("gb_write")="ok" then
    response.write write_chk()
  else
    response.write write_type()
  end if
  response.write vbcrlf&"</td></tr></table>"
end sub

function write_type()
  response.write val_code(1)
  write_type=vbcrlf & "<script language=javascript src='style/form_gbook.js'></script>" & _
	     vbcrlf & "<table width='99%' border=0 align=center cellpadding=2 cellspacing=1>" & _
	     vbcrlf & "<tr class=tdbg-tree><form name=write_frm method=POST action='gbook.asp?action=write' onsubmit=""frm_submitonce(this);"">" & _
	     vbcrlf & "<input type=hidden name=gb_write value='ok'>" & _
	     vbcrlf & "<td align=center colspan=4><font class=time><b>注意：</b></font>以下星号（" & redx & "）标出的项目必需填写</td>" & _
	     vbcrlf & "</tr><tr class=tdbg-dark><td align=center width=80 height=25>你的名字：</td>" & _
	     vbcrlf & "<td width=224><input type=text name=wrname value='" & login_username & "' size=27 maxlength=9>" & redx & "</td>" & _
	     vbcrlf & "<td width=100 align=center>&nbsp;<a title='查看所有头像' href='user_face.asp' target=_blank>→查看所有头像</a></td>" & _
	     vbcrlf & "<td width=71 align=center>" & _
	     vbcrlf & "<select size=1 name=wrface style=""width： 50; border： 1px solid #C0C0C0"" onChange=""showimage()"">" & _
	     vbcrlf & "<option value=0 selected>0</option>" & _
	     vbcrlf & "<option value=1>1</option>" & _
	     vbcrlf & "<option value=2>2</option>" & _
	     vbcrlf & "<option value=3>3</option>" & _
	     vbcrlf & "<option value=4>4</option>" & _
	     vbcrlf & "<option value=5>5</option>" & _
	     vbcrlf & "<option value=6>6</option>" & _
	     vbcrlf & "<option value=7>7</option>" & _
	     vbcrlf & "<option value=8>8</option>" & _
	     vbcrlf & "<option value=9>9</option>" & _
	     vbcrlf & "<option value=10>10</option>" & _
	     vbcrlf & "<option value=11>11</option>" & _
	     vbcrlf & "<option value=12>12</option>" & _
	     vbcrlf & "<option value=13>13</option>" & _
	     vbcrlf & "<option value=14>14</option>" & _
	     vbcrlf & "<option value=15>15</option>" & _
	     vbcrlf & "<option value=16>16</option>" & _
	     vbcrlf & "<option value=17>17</option>" & _
	     vbcrlf & "<option value=18>18</option>" & _
	     vbcrlf & "<option value=19>19</option>" & _
	     vbcrlf & "<option value=24>24</option>" & _
	     vbcrlf & "</select></td></tr>" & _
	     vbcrlf & "<tr><td align=center width=80 height=25 class=tdbg-dark>性别：</td>" & _
	     vbcrlf & "<td width=224 class=tdbg-dark>&nbsp;Boy <input type=radio value='boy' name=wrsex checked class=bg_1>&nbsp;&nbsp; Girl <input type=radio name=wrsex value='girl' class=bg_1></td>" & _
	     vbcrlf & "<td width=196 rowspan=5 align=center colspan=2><img border=0 src='images/face/0.gif' name=wrimg></td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center height=25>QQ：</td>" & _
	     vbcrlf & "<td width=224><input type=text name=wrqq size=28 maxlength=15></td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center height=25>电子邮件：</td>" & _
	     vbcrlf & "<td width=224><input type=text name=wremail size=28 maxlength=50></td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center height=25>你的主页： </td>" & _
	     vbcrlf & "<td width=224><input type=text name=wrurl size=28 value='http://' maxlength=50></td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center height=25>来自：</td>" & _
	     vbcrlf & "<td width=224><input type=text name=wrwhe size=28 maxlength=20></td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center height=25>留言主题：</td>" & _
	     vbcrlf & "<td width=420 colspan=3><input type=text name=wrtopic size=38 maxlength=50>" & redx & "</td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center height=25>表情图标： </td>" & _
	     vbcrlf & "<td align=left width=420 colspan=3>"&icon_type(7,1)&"</td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center width=80 valign=top><br>你的留言：<br><br></td>" & _
	     vbcrlf & "<td width=420 colspan=3>" & _
	     vbcrlf & "<table border=0 cellpadding=0 cellspacing=0 width='100%'>" & _
	     vbcrlf & "<tr><td width='69%'><textarea rows=7 name=wrword cols=60 maxlength=1000 title='按 Ctrl+Enter 可直接发送' onkeydown=""javascript:frm_quicksubmit();""></textarea></td></tr></table>" & _
	     vbcrlf & "</td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center width=80 height=25>是否隐藏：</td>" & _
	     vbcrlf & "<td width=420 colspan=3><input type=radio name=wrhidden value='no' checked class=bg_1>正常<input type=radio name=wrhidden value='yes' class=bg_1>隐藏" & redx & "选择隐藏后，此留言只有站长才可以看到。</td></tr>" & _
	     vbcrlf & "<tr class=tdbg-dark><td align=center>验 证 码：</td><td colspan=3>"&val_code(2)&"</td></tr>" & _
	     vbcrlf & "<tr height=50 class=tdbg-dark><td></td><td colspan=3>" & _
	     vbcrlf & "<input type=submit name=wsubmit value=' 可 以 发 送 啦 ' onclick=""return check(write_frm)"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" & _
	     vbcrlf & "<input type=reset value=' 重 新 再 来 ' onclick=""return reset()"">" & _
	     vbcrlf & "</td></form></tr></table><br>"
end function

function write_chk()
  dim founderr,drname,drsex,drqq,dremail,drurl,drwhe,drtopic,dricon,drface,drword,drremark,drhidden,valcode
  drname=trim(request.form("wrname"))
  drname=objv7.code_form(drname)'---------------
  drsex=trim(request.form("wrsex"))
  drqq=trim(request.form("wrqq"))
  if drqq="" or isnull(drqq) then drqq="nuller"
  dremail=trim(request.form("wremail"))
  if dremail="" or isnull(dremail) then dremail="nuller"
  drurl=trim(request.form("wrurl"))
  if drurl="http://" or isnull(drurl) then drurl="nuller"
  drwhe=trim(request.form("wrwhe"))
  drwhe=objv7.code_form(drwhe)'---------------
  if drwhe="" or isnull(drwhe) then drwhe="nuller"
  dricon=trim(request.form("icon"))
  drface=trim(request.form("wrface"))
  drtopic=trim(request.form("wrtopic"))
  drtopic=objv7.code_form(drtopic)'---------------
  drword=request.form("wrword")
  drremark=request.form("wrremark")
  drhidden=trim(request.form("wrhidden"))
  valcode="jk"&trim(request.form("valcode"))
  
  founderr=""
  if symbol_name(drname)="no" then
    founderr=founderr & "<br><li>请输入您的 <font class=founderr>用户名</font>（长度不能大于20）！"
  end if
  if drqq<>"nuller" then 
    if not(isnumeric(drqq)) then
      founderr=founderr & "<br><li>您的 <font class=founderr>QQ</font>> 只能为数字！"
    end if
  end if
  if dremail<>"nuller" then 
    if objv7.email_ok(dremail)=false then
      founderr=founderr & "<br><li>您输入的 <font class=founderr>Email</font> 格式有错误！"
    end if
  end if
  if drtopic="" or isnull(drtopic) then
    founderr=founderr & "<br><li><font class=founderr>主题</font> 是必需要的！请输入。"
  end if
  if drword="" or isnull(drword) then
    founderr=founderr & "<br><li><font class=founderr>留言内容</font> 是必需要的！请输入。"
  end if
  if val_code(3)<>"yes" then
    founderr=founderr & "<br><li>您输入的 <font class=time>验 证 码</font> 为空或有错误！<br>"
  end if
  
  if founderr="" then
    dim rs,strsql
    set rs=server.createobject("adodb.recordset")
    strsql="select * from gb_data where (id is null)"
    rs.open strsql,conn,1,3
    rs.addnew
    rs("nname")=drname
    rs("sex")=drsex
    rs("whe")=drwhe
    rs("qq")=drqq
    rs("email")=dremail
    rs("url")=drurl
    rs("ip")=objv7.ip_sys(1,1)
    rs("sys")=objv7.ip_sys(3,0)
    rs("icon")=dricon
    rs("face")=drface
    rs("topic")=drtopic
    rs("word")=drword
    rs("tim")=now_time
    rs("re_icon")="0"
    if drhidden="yes" then
      rs("hidden")=true
    else
      rs("hidden")=false
    end if
    rs.update
    rs.close:set rs=nothing
    response.write VbCrLf & "<br>！！！<font class=time>谢谢你的留言</font>！！！" & VbCrLf & "<br><br><a href='gbook.asp'>返回网站留言</a>" & VbCrLf & "<br><br>（系统将在 " & objv7.web_var(web_num,5) & " 秒钟后自动返回）" & _
		   VbCrLf & "<meta http-equiv='refresh' content='" & objv7.web_var(web_num,5) & "; url=gbook.asp'>"
  else
    response.write found_error(founderr,"250")
  end if
end function
%>