
<!--#include file="conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="../fuction.asp"-->
<% if session("username")=empty then
response.redirect "login.asp"
end if
bid=nosql(int(request.querystring("bid")))
id=nosql(int(request.querystring("id")))
title=nosql(trim(Replace(Request.Form("title"),vbcrlf," ")))
title=server.htmlencode(title)
faceimg=nosql(trim(request.form("faceimg")))
body=nosql(ContentEncode(request.form("body")))
username=nosql(session("username"))
 
 
if len(title)<2 then
response.write"<script language='javascript'>alert('对不起，帖子主题不能小于两个字符')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if

if len(body)<2  then
response.write"<script language='javascript'>alert('对不起，内容不能小于两个字符空')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if

ls=session("lasttime")
if ls+1/8640>now() then
response.write"<script language='javascript'>alert('请不要重复提交帖子')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if

set rs=server.CreateObject("adodb.recordset")
sql="select * from book"
rs.open sql,conn,3,3
rs.addnew
rs("title")=title
rs("body")=body
rs("bid")=bid
rs("fid")=id
rs("type")=id
rs("username")=username
rs("faceimg")=faceimg

rs.update
rs.close

conn.execute("update [info] set allreply=allreply+1")
conn.execute("update [book] set reply=reply+1,ldate='"&now()&"',lastname='"&username&"' where id="&id&"")
response.redirect "list.asp?bid="&bid
conn.execute("update [shop_shop] set topic=topic+1 where username='"&username&"'")
%>

