<!-- #include file="include/con_help.asp" -->
<!-- #include file="include/jk_ubb.asp" -->
<!-- #include file="include/jk_email.asp" -->
<!-- #include file="include/jk_val_code.asp" -->
<!-- #include file="include/jk_page_cute.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<%
dim nummer,nums,rssum,page,viewpage,thepages,pageurl
pageurl="?"
nummer=6
nums=nummer
index_url="gbook"
select case action
case "write"
  tit_fir="网站留言"
  tit="签写留言"
case else
  tit="网站留言"
end select

if action="write" then
  call web_head(2,1,0,0,0)
else
  call web_head(0,0,0,0,0)
end if 

'----------------------------左边 开始----------------------------
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td1>&nbsp;<%response.write img_skin("m_")%>网站留言</td></tr>
<tr class=bg_td><td align=center>
  <table border=0 cellspacing=2 cellpadding=4 width='100%'>
  <tr><td align=center><%response.write img_skin("m_")%><a href='gbook.asp?action=write' class=blue><b>签写我的留言</b></a></td></tr>
  <tr><td>任何人都可以在这里留言，只有注册并登陆后才可以看到其它留言者的系统信息。</td></tr>
  <tr><td>系统支持：Unicode支持，UBB 支持，HTML不支持</td></tr>
  </table>
</td></tr>
</table>
<%
response.write ukong
call left_action()
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
response.write vbcrlf&"<table cellspacing=1 cellpadding=4 class=table>"

select case action
case "write"
  call gbook_write()
case else
  call gbook_main()
end select

response.write vbcrlf&"</table>"
response.write ukong
'----------------------------中间 结束----------------------------
call web_end(0,0)

sub gbook_write()
  call time_lock()
%>
<tr><td class=td1 colspan=3>&nbsp;<%response.write img_skin("m_")&tit%></td></tr>
<%
  dim found_err,drname,drsex,drqq,dremail,drurl,drwhe,drtopic,dricon,drface,drword,drremark,drhidden,valcode
  if joekoe_cms.chk() then
    drname=trim(request.form("wrname"))
    drname=joekoe_cms.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"))
    drurl=joekoe_cms.code_form(drurl)
    if drurl="http://" or isnull(drurl) then drurl="nuller"
    drwhe=trim(request.form("wrwhe"))
    drwhe=joekoe_cms.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=joekoe_cms.code_form(drtopic)'---------------
    drword=request.form("wrword")
    drremark=request.form("wrremark")
    drhidden=trim(request.form("wrhidden"))
    valcode="jk"&trim(request.form("valcode"))
  
    found_err=""
    if not post_tim() then
      found_err=found_err&"+对不起，留言的间隔时间为 <font class=red>"&int(dim_num(28))&"</font> 秒！<br>"
    end if    
    if symbol_name(drname)="no" then
      found_err=found_err & "+请输入您的 <font class=red>用户名</font>（长度不能大于20）<br>"
    end if
    if drqq<>"nuller" then 
      if not(isnumeric(drqq)) then
        found_err=found_err & "+您的 <font class=red>QQ</font>> 只能为数字！<br>"
      end if
    end if
    if dremail<>"nuller" then 
      if email_ok(dremail,50)=false then
        found_err=found_err & "+您输入的 <font class=red>Email</font> 格式有错误！<br>"
      end if
    end if
    if drtopic="" or isnull(drtopic) then
      found_err=found_err & "+留言的 <font class=red>主题</font> 是必需要的！请输入。<br>"
    end if
    if drword="" or isnull(drword) then
      found_err=found_err & "+留言的 <font class=red>留言内容</font> 是必需要的！请输入。<br>"
    end if
    if val_chk(index_url)=false then
      found_err=found_err&"+您输入的 <font class=red>验 证 码</font> 为空或有错误，请勿非法提交！<br>"
    end if
    if found_err<>"" then
      response.write "<tr class=bg_td><td align=center height=300 colspan=3>"&found_error(found_err,260)&"</td></tr>"
      exit sub
    end if
    sql="select * from gb_data where (id is null)"
    call joekoe_cms.exec("",-1)
    rs.open sql,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")=user_ip
    rs("sys")=user_sys
    rs("icon")=dricon
    rs("face")=drface
    rs("topic")=drtopic
    rs("word")=drword
    rs("tim")=joekoe_cms.now_time
    rs("re_icon")="0"
    if drhidden="yes" then
      rs("hidden")=true
    else
      rs("hidden")=false
    end if
    rs.update
    rs.close
%>
<tr class=bg_td><td align=center height=300 colspan=3>
！！<font class=red>谢谢你的留言</font>！！！<br><br>
<a href='gbook.asp'>返回网站留言</a><br><br>
（系统将在 <font class=red><%response.write dim_num(21)%></font> 秒钟后自动返回）
<meta http-equiv='refresh' content='<%response.write dim_num(21)%>; url=gbook.asp'>
</td></tr>
<%
    call val_chk_end(index_url)
    exit sub
  end if
%>
<script language=javascript>
<!--
function isCharsInBag(inputchar, bagchar)
{ 
  var ii,cc;
  for (ii = 0; ii < inputchar.length; ii++)
  { 
    cc = inputchar.charAt(ii);
    if (bagchar.indexOf(cc) > -1) { return "no"; }
    else { return "yes"; }
  }
}
function check(write_frm)
{
  var errorcharname="><,[>{}?/+=|\\'\":;~!#$%()`@";
  var errorcharqq="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz><,[>{}?/+=|\\'\":;~!#$%()`";
  var wr_name=write_frm.wrname.value;
  if(wr_name=="" || wr_name==null)
  {
    alert("你还没完全留下所需信息！\r\n你的 名字 是必须要的。");
    document.write_frm.wrname.focus();
    return false;
  }
  var errorname=isCharsInBag(wr_name,errorcharname);
  if ( errorname=="no" )
  {
    alert("你的 名字 不得含有以下字符！\r\n  ><,[{}?/+=|\\'\":;~!#$%()`");
    document.write_frm.wrname.focus();
    return false;
  }
  var wr_qq=write_frm.wrqq.value;
  if(write_frm.wrqq.value!=="")
  {
    var errorqq=isCharsInBag(wr_qq,errorcharqq);
    if ( errorqq=="no" )
    {
      alert("你的 QQ 只能是数字！\r\n请重新输入。");
      document.write_frm.wrqq.focus();
      return false;
    }
  }
  var wr_email=write_frm.wremail.value;
  if(wr_email!=="")
  {
    var AtSym = wr_email.indexOf('@');
    var Period = wr_email.lastIndexOf('.');
    var Space = wr_email.indexOf(' ');
    var Length = wr_email.length - 1;
    if ((AtSym < 1) || (Period <= AtSym+1) || (Period == Length ) || (Space != -1))
    { 
      alert('你的 eMail地址 格式不对！\r\n请重新输入。');
      document.write_frm.wremail.focus();
      return false;
    } 
  }
  var wr_whe=write_frm.wrwhe.value;
  if(wr_whe!=="")
  {
    var errorwhe=isCharsInBag(wr_whe,errorcharname);
    if ( errorwhe=="no" )
    {
      alert("你的 来自 不得含有以下字符！\r\n  ><,[{}?/+=|\\'\":;~!#$%()`");
      document.write_frm.wrwhe.focus();
      return false;
    }
  }
  var wr_topic=write_frm.wrtopic.value;
  if(wr_topic=="")
  {
    alert("你还没完全留下所需信息！\r\n你的 主题 是必须要的。");
    document.write_frm.wrtopic.focus();
    return false;
  }
  var wr_word=write_frm.wrword.value;
  if(wr_word=="")
  {
    alert("你还没完全留下所需信息！\r\n你的 留言内容 是必须要的。");
    document.write_frm.wrword.focus();
    return false;
  }
}
function reset(write_frm)
{
  if (confirm("该项操作要清除全部的内容，你确定要清除吗?")) { return true; }
  return false;
}
function showimage() { document.images.wrimg.src = "images/face/"+document.write_frm.wrface.options[document.write_frm.wrface.selectedIndex].value+".gif"; }
-->
</script>
<form name=write_frm action='gbook.asp?action=write' method=post onsubmit="frm_submitonce(this);">
<input type=hidden name=chk value='yes'>
<%response.write val_code_num(index_url,1)%>
<tr class=bg_tds><td align=center height=30 colspan=3><font class=red><b>注意：</b></font>以下星号（<%response.write redx%>）标出的项目必需填写</td></tr>
<tr class=bg_td>
<td width='16%' height=25>你的名字：</td>
<td width='44%'><input type=text name=wrname value='<%response.write login_username%>' size=27 maxlength=20><%response.write redx%></td>
<td width='40%' align=center>&nbsp;<a title='查看所有头像' href='user_face.asp' target=_blank>→查看所有头像</a>
<select size=1 name=wrface style="width： 50; border： 1px solid #C0C0C0" onChange="showimage()">
<option value=0 selected>0</option>
<%
  for i=1 to dim_num(5)
    response.write vbcrlf&"<option value='"&i&"'>"&i&"</option>"
  next
%>
</select></td>
</tr>
<tr class=bg_td>
<td>性别：</td>
<td>&nbsp;Boy <input type=radio value='boy' name=wrsex checked class=bg_td>&nbsp;&nbsp; Girl <input type=radio name=wrsex value='girl' class=bg_td></td>
<td rowspan=5 align=center><img border=0 src='images/face/0.gif' name=wrimg></td>
</tr>
<tr class=bg_td>
<td>QQ：</td>
<td><input type=text name=wrqq size=28 maxlength=15></td>
</tr>
<tr class=bg_td>
<td>电子邮件：</td>
<td><input type=text name=wremail size=28 maxlength=50></td>
</tr>
<tr class=bg_td>
<td>你的主页： </td>
<td><input type=text name=wrurl size=28 value='http://' maxlength=50></td>
</tr>
<tr class=bg_td>
<td>来自：</td>
<td><input type=text name=wrwhe size=28 maxlength=20></td>
</tr>
<tr class=bg_td>
<td>留言主题：</td>
<td colspan=2><input type=text name=wrtopic size=65 maxlength=50><%response.write redx%></td>
</tr>
<tr class=bg_td>
<td>表情图标： </td>
<td colspan=2><%response.write jk_icon(0)%></td>
</tr>
<tr class=bg_td>
<td valign=top><br>你的留言：<br><br><%response.write web_frm_word%></td>
<td colspan=2><textarea rows=7 name=wrword cols=65 maxlength=1000 title='按 Ctrl+Enter 可直接发送' onkeydown="javascript:frm_quicksubmit();"></textarea></td>
</tr>
<tr class=bg_td>
<td>是否隐藏：</td>
<td colspan=2><input type=radio name=wrhidden value='no' checked class=bg_td>正常<input type=radio name=wrhidden value='yes' class=bg_td>隐藏<%response.write redx%>选择隐藏后，此留言只有管理员才可以看到。</td>
</tr>
<tr height=40 class=bg_tds><td colspan=3 align=center><input type=submit name=wsubmit value=' 可 以 发 送 啦 ' onclick="return check(write_frm)">　　<input type=reset value=' 重 新 再 来 ' onclick="return reset()"></td></tr>
</form>
<%
end sub

sub gbook_main()
  dim id,nname,sex,qq,email,url,whe,topic,ip,re_word,hidden,h_view
  h_view=false
  if cstr(login_username)=cstr(web_dim(3)) then h_view=true
  sql="select count(id) from gb_data"
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  if int(rssum)<1 then
    call gbook_write()
    exit sub
  end if
  call format_pagecute()
  sql="select top "&nummer*viewpage&" * from gb_data order by id desc"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
    id=rs("id")
    nname=rs("nname")
    sex="男孩"
    if rs("sex")="girl" then sex="女孩"
    qq=rs("qq")
    email=rs("email")
    url=joekoe_cms.code_html(rs("url"),1,0)
    whe=rs("whe")
    topic=rs("topic")
    ip=rs("ip")
    re_word=code_jk(rs("re_word"))
    hidden=rs("hidden")
%>
<tr><td class=td1>&nbsp;No.<%response.write rssum-(i+(viewpage-1)*nummer)+1%>&nbsp;主题：<font alt='<%response.write joekoe_cms.code_html(topic,1,0)%>'><%response.write joekoe_cms.code_html(topic,1,36)%></font></td></tr>
<tr><td class=bg_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><%response.write nname%></td></tr>
      <tr><td align=center><img src='images/face/<%=rs("face")%>.gif' alt='<%=nname&" 是 "&sex%>' border=0></td></tr>
      <tr><td align=center><% if whe<>"nuller" then response.write "来自：<font alt='"&joekoe_cms.code_html(whe,1,0)&"'>"&joekoe_cms.code_html(whe,1,5)&"</font>"%></td></tr>
      </table>
    </td>
    <td width=1></td>
    <td width=* height='100%'>
      <table border=0 width='100%' height='100%' cellspacing=0 cellpadding=0>
      <tr><td colspan=2 align=center valign=top>
        <table border=0 width='100%' cellspacing=0 cellpadding=2 class=tf>
        <tr><td class=bw><font class=htd>
<%
    if hidden=true and h_view=false then
      response.write "<br><br><center><font class=red2>^-^ 此条留言只有管理员才可以看哦 ^-^</font></center><br><br>"
    else
      response.write "<img src='images/icon/"&rs("icon")&".gif' border=0 align=absmiddle>&nbsp;"
      if hidden=true then
        response.write "<font class=red2>[隐藏]</font>&nbsp;"
      end if
      response.write code_jk(rs("word"))
    end if
%>
        </font></td></tr>
        </table>
<%
    if len(re_word)>0 then
      response.write vbcrlf & "<table cellspacing=1 cellpadding=4 width='100%' align=center class=tf><tr class=bg_tds><td class=bw>" & _
		     vbcrlf & "<font class=red>管理员回复于：</font>" & rs("re_tim") & "<br>" & _
		     vbcrlf & "<img src='images/icon/" & rs("re_icon") & ".gif' border=0>&nbsp;" & re_word & _
		     vbcrlf & "</td></tr>" & _
		     vbcrlf & "</table>"
    end if
%>
      </td></tr>
      <tr><td height=5></td></tr>
      <tr><td height=1 colspan=2></td></tr>
      <tr height=20>
      <td width='60%'>&nbsp;<img src='<%response.write joekoe_cms.web_dir_skin%>small/tim.gif' align=absmiddle alt='签写时间' border=0>&nbsp;<%response.write joekoe_cms.time_type(rs("tim"),88)%></td>
      <td width='40%' align=right><%
    if qq<>"nuller" and login_mode<>"" then
      response.write "<a href='http://wpa.qq.com/msgrd?V=1&Uin="&qq&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"small/qq.gif' alt='"&nname&" 的QQ是："&qq&"' border=0></a>&nbsp;"
    end if
    if var_null(url)<>"" and url<>"nuller" and url<>"http://" and login_mode<>"" then
      response.write "<a href='"&joekoe_cms.code_html(url,1,0)&"' target=_blank><img src='"&joekoe_cms.web_dir_skin&"small/url.gif' alt='访问 "&nname&" 的主页' border=0></a>&nbsp;"
    end if
    if email<>"nuller" and login_mode<>"" then
      response.write "<a href='mailto:"&email&"'><img src='"&joekoe_cms.web_dir_skin&"small/email.gif' alt='给 "&nname&" 发电子邮件' border=0></a>&nbsp;"
    end if
    if login_username<>"" and login_password<>"" and login_mode<>"" then
      response.write "<img src='"&joekoe_cms.web_dir_skin&"small/ip.gif' align=absMiddle alt='IP保密' border=0>&nbsp;" & _
		     "<img src='"&joekoe_cms.web_dir_skin&"small/sys.gif' align=absMiddle alt='"&nname&" 的 "&user_sys_type(rs("sys"))&"' border=0>"
    end if
%>
      </td>
      </tr>
      </table>
    </td></tr>
    </table>
  </td></tr>
  </table>
</td></tr>
<%
    rs.movenext
  next
  rs.close
%>
<tr class=bg_tds height=30><td>&nbsp;共有<font class=red><%response.write rssum%></font>条留言&nbsp;页次：<font class=red><%response.write viewpage&"</font>/<font class=red>"&thepages%></font>&nbsp;分页：<% response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000") %></td></tr>
<%
end sub
%>