<%
action=request.QueryString("action")
if action="submit" then
question_title=trim(request.form("question_title"))
question_author=trim(request.form("question_author"))
question_email=trim(request.form("question_email"))
question_text=request.Form("question_text")
dir_id=request.form("dir_id")
if len(question_title)<1 or len(question_text)<1 then
Response.Write("")
connclose
Response.End()
end if
'添加排名
sql="select top 1 * from faq"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew
rs("question_title")=question_title
rs("question_author")=question_author
rs("question_email")=question_email
rs("question_text")=question_text
rs("dir_id")=dir_id
rs("question_date")=now
rs.update
rs.close
set rs=nothing
Response.Write("")
end if
if id<=0 then
call ShowAll
else
call ShowOne(id,ShowOne_num)
end if
Sub ShowOne(the_dir_id,the_num)
dim where_dir,rs,rs_dir
where_dir="dir_id="&the_dir_id
where_dir="answer_text<>'' and "&where_dir
num=conn.execute("select count(post_id) from "&table_name&" where "&where_dir)(0)
pagenum=(num-1)\NumPerPage+1
if pagenum<1 then pagenum=1
page=CheckNum(Request.QueryString("page"))
if page-1<=0 then page=1
if page-pagenum>0 then page=pagenum
set rs_dir=conn.execute("select dir_name,path_name,dir_description from "&table_name&"_dir where dir_id="&the_dir_id)
if not rs_dir.eof then
path_name=rs_dir("path_name")
dir_name=rs_dir("dir_name")
dir_description=rs_dir("dir_description")
end if
set rs_dir=nothing
%>
<%
If num>0 then
Response.Write("
<%=dir_name%>
<%=dir_description%>
- "&vbcrlf)
set rs=server.CreateObject("adodb.recordset")
sql="select * from "&table_name&" where "&where_dir&" order by question_date desc"
rs.open sql,conn,1,1
rs.pagesize=NumPerPage
rs.absolutepage=page
while not rs.eof
Response.Write("
·"&GetIntro(rs("question_title"),intro_len)&"
"&rs("question_date")&""&vbcrlf)
rs.movenext
wend
set rs=nothing
Response.Write("
"&rs_dir("dir_name")&"
"&vbcrlf) Response.Write("- "&vbcrlf)
set rs=conn.execute("select top "&ShowAll_num&" * from "&table_name&" where answer_text<>'' and dir_id="&rs_dir("dir_id")&" order by question_date desc")
while not rs.eof
Response.Write("
·"&GetIntro(rs("question_title"),intro_len)&"
"&rs("question_date")&""&vbcrlf)
rs.movenext
wend
set rs=nothing
Response.Write("