<!--#include file="chkinput.asp"-->
<!--#include file="conn.asp"-->
<%  
    bid=cint(request.form("bid"))
    if isempty(bid) or bid="" then bid=1
    fid=request.form("fid")
    if isempty(fid) or fid="" then fid=0
  
    title=trim(Replace(Request.Form("title"),vbcrlf," "))
	title=Replace(title,chr(23),"")
	title=Replace(title,chr(9),"")
	title=Replace(title,chr(8),"")
    title=Replace(title,chr(34),"")
    body=request.form("body")
    body=trim(Replace(Request.Form("body"),vbcrlf," "))
    body=Replace(body,chr(23),"")
	body=Replace(body,chr(9),"")
	body=Replace(body,chr(8),"")
    body=Replace(body,chr(34),"")
    title=server.htmlencode(title)
   
  
    if title="" then
response.write"<script language='javascript'>alert('对不起，帖子主题不能为空')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if

    if  strLength(title)>Cint("55")   then
    response.write"<script language='javascript'>alert('对不起，帖子主题不能超过25个字')</script>"
    response.write "<script language='javascript'>history.back(-1)</script>"
    end if
	
    if isempty(body) or body="" then
     response.write"<script language='javascript'>alert('内容不能为空')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
      end if
  
	
	
	if cint(fid)<>0 then
	    retype=fid
	else
	    retype=0
	end if
	wdate=now()
	ldate=now()
	
username=Request.Cookies("esung")("username")
password=Request.Cookies("esung")("password")
set rs=server.createobject("adodb.recordset")
    sql="select * from member where username='" &username& "'  "
    rs.open sql,conn,1,1
    if  rs.eof then
response.write"<script language='javascript'>alert('用户名密码错误！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if
  if password<>rs("password") then
  response.write"<script language='javascript'>alert('用户名密码错误！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if

if rs("lock")=1 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>"
    end if

	
if rs("manbid")=20000 or rs("manbid")=bid or rs("manbid")=8888 then

conn.execute("insert into smallpaper (title,username,body,riqi,bid) values('"&title&"','"&username&"','"&body&"','"&now()&"','"&bid&"')")
session("lasttime")=Now()
	    
response.redirect "list.asp?bid="&bid
else
 response.write"<script language='javascript'>alert('你没权限发小字报！')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if


%>

