<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<%
Select Case Request("action")
  Case ""
     writes()
  Case 0
     submit()
End Select

Function writes()
data=cw_redtemp(cf_root&"skins/"&cf_skin,tp_book)
data=replace(data,"{cw:book_position}","<a href='"&cf_root&"'>首页</a> &gt; 在线留言")
data=cw_include(data)     
data=cw_system(data)
If request("page")="" Then
  pa=1
Else
  pa=cint(request("page"))
End if
data=cw_loop(data,5,pa)'5条一页  
If pa>1 Then
  data=replace(data,"{cw:book_page}","(第"&pa&"页)") 
Else
  data=replace(data,"{cw:book_page}","")
End If
data=cw_function(data)
data=cw_if(data)
response.Write(data)
response.End()
End Function

Function submit()
Call Cw_sql()
Call Cw_yztime(60)'提交间隔
user=trim(request("user"))
tel=trim(request("tel"))
company=trim(request("company"))
content=trim(request("content"))
yzm=trim(request("yzm"))
If yzm<>Session("iCode") then
   Response.Write("<script>alert('验证码错误！');history.back();</script>")
   response.End()
End If
Set Rs=Server.CreateObject("Adodb.Recordset")
sql="select user,tel,company,content,adddate,ispass from Cw_book"
rs.open sql,conn,1,3
rs.addnew
rs(0)=user
rs(1)=tel
rs(2)=company
rs(3)=content
rs(4)=now()
rs(5)=isbook
rs.update
rs.close
set rs=nothing
Response.Write("<script>alert('留言提交成功！');location.href='.'</script>")
End Function

Call closes()
%>