%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
dim king,i,rs,sql,PerPage,text,checkpage,currentpage,iter,action:action=request("action")
set king=new kingcms
king.head 0,0
select case action
case"" :king_def()
case "save" :king_save()
end select
king_outhtm
set king=nothing
function iteration()
Randomize
iter = fix(rnd()*10000)
iteration=iter
end function
'def *** *** www.KingCMS.com *** ***
sub king_def()'需要加入標題,訪問級別
dim classid,selected
dim space
space=l1ll("space",2)
classid=l1ll("classid",2)
session("iteration")=iteration()
kingtitle="客戶留言"
kingguide=king.guide(0)&kingtitle
ol=ol&"
"%>
<%
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from zybook where Fox='1' order by id desc"
rs.open sql,conn,1,1
if not rs.eof then
PerPage=5
text="0123456789"
rs.PageSize=PerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > rs.PageCount Then CurrentPage = rs.PageCount
Else
CurrentPage= 1
End If
If not rs.eof Then rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
'call showpages
call list
'If rs.recordcount > PerPage then
'call showpages
'end if
end if
rs.close
end sub
'顯示帖子的子程序
Sub list()
ol=ol&" "
ol=ol&"
"
i=0
do while not rs.eof
ol=ol&"
留言:
"&rs("content")&"("&rs("time")&")
"
if rs("rebook")<>"" then
ol=ol&"
回復:
"&rs("rebook")&"
"
end if
ol=ol&"
"
i=i+1
rs.movenext
if i=PerPage then
exit do
end if
loop
ol=ol&"
"
if rs.PageCount>1 then
ol=ol&"
"
ol=ol&"
"
ol=ol&" -> 全部-共"
ol=ol&" " & "" & Cstr(rs.RecordCount) & "" & "條留言 "
ol=ol&" 第" & "" & Cstr(CurrentPage) & "" & "/" & Cstr(rs.pagecount) & "頁 "& PerPage &"條/頁 "
If currentpage > 1 Then
ol=ol&" 首頁 "
ol=ol&" 上一頁 "
Else
ol=ol&" 上一頁 "
End if
If currentpage < rs.PageCount Then
ol=ol&" 下一頁 "
ol=ol&" 尾頁 "
Else
ol=ol&" "
ol=ol&" 下一頁 "
End if
ol=ol&" 轉到:"
ol=ol&"
"
end if
End sub
sub king_save()
kingtitle="客戶留言"
kingguide=king.guide(0)&kingtitle
dim isok:isok=true
If request.form("content")="" Then
ol=ol&"
錯誤:您沒輸入留言內容,請返回檢查??! "
isok=false
end if
if isok and clng(session("iteration"))=clng(request("flag")) then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from zybook"
rs.open sql,conn,1,3
rs.addnew
rs("name")=htmlencode2(trim(request.form("name")))
rs("Phone")=htmlencode2(trim(request.form("Phone")))
rs("address")=htmlencode2(trim(request.form("address")))
rs("email")=htmlencode2(trim(request.form("email")))
rs("post")=htmlencode2(trim(request.form("post")))
rs("content")=htmlencode2(trim(request.form("content")))
rs("time")=now()
rs.update
rs.close
ol=ol&"您的留言已提交成功!"
session("iteration")="123"
else
ol=ol&"
錯誤:請不要重復提交??! "
isok=false
end if
end sub
'outhtm *** *** www.KingCMS.com *** ***
sub king_outhtm()%>
顧客留言-湘西自治州邊城醋業科技有限公司