<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../conn/nosql.asp"-->
<!--#include file="../../conn/config.asp"-->
<!--#include file="../../conn/count.asp"-->
<!--#include file="../page.asp"-->
<!--#include file="../count.asp"-->
<%
if isChkInteger(request("web_id")) then
web_id=request("web_id")
else
Response.Redirect ("../../index.asp")
end if
if session("user")="" then
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
if session("id")="" then 
response.write "<script language='javascript'>"
response.write "alert('您没还有登录，请登录后再访问本页！');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
if nosql(request("action"))="add" then
''''''''''替换模块START''''''''''''
Function ReplaceText(fString,patrn, replStr)
Set regEx = New RegExp  ' 建立正则表达式。
regEx.Pattern = patrn   ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分大小写。
regEx.Global = True     ' 设置全局可用性。 
ReplaceText = regEx.Replace(fString, replStr) ' 作替换。
End Function
''''''''''替换模块END''''''''''''
function ContentEncode(fString)
fString=Replace(fString ,vbCrLf,"<br>")
fString=Replace(fString,chr(32)&chr(32), "<BR>")
fString=replace(fString,vbCrlf, "")
fString=replace(fString,"\","&#92;")
fString=replace(fString,"'","&#39;")
fString=replace(fString,"我爱你gege","<Img src=../gege.jpg>")
fString=ReplaceText(fString,"<(.[^>]*)(&#|cookie|window.|Document.|javascript:|js:|vbs:|about:|file:|on(blur|click|change|Exit|error|focus|finish|key|load|mouse))", "&lt;$1$2$3")
fString=ReplaceText(fString,"<(\/|)(iframe|object|SCRIPT|form|style|meta|TEXTAREA)", "&lt;$1$2")
ContentEncode=fString
end function

title=nosql(trim(Replace(Request.Form("title"),vbcrlf," ")))
faceimg=nosql(trim(request.form("faceimg")))
body=ContentEncode(request.form("body"))
classid=nosql(trim(request.form("classid")))
username=nosql(session("user"))
show=nosql(request.form("show"))
zshow=nosql(request.form("zshow"))
web_id=web_id
body=body&show
if show<>"" and zshow<>"" then
Response.Write "<script Language=Javascript>alert('使用魔法表情请先关闭文字秀功能！');javascript:history.go(-1)</script>"
Response.end
end if
 
if len(title)<1 then
response.write"<script language='javascript'>alert('对不起，帖子主题不能小于一个字符')</script>"
response.write "<script language='javascript'>history.back(-1)</script>"
response.end
end if

if len(body)<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>"
response.end
end if

sql="select * from snsn_user where  id="&session("id")&""
Set rsjf= Server.CreateObject("ADODB.Recordset") 
rsjf.open sql,conn,1,3
if rsjf.eof or rsjf.bof then
response.write "<script language='javascript'>"
response.write "alert('没有此用户，请确认后或联系管理员再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
end if
rsjf.close
set rsjf=nothing

set rs=server.CreateObject("adodb.recordset")
sql="select * from snsn_bbs"
rs.open sql,conn,1,3
rs.addnew
rs("title")=title
rs("body")=body
rs("username")=username
rs("faceimg")=faceimg
rs("hits")=0
rs("reply")=0
rs("wdate")=now()
rs("ldate")=now()
rs("userid")=web_id
rs("classid")=classid
if zshow<>"" then
rs("zshow")=1
end if
rs.update



'爱心(发贴，传相片，传音乐，推荐人)

Set hua= Server.CreateObject("ADODB.Recordset") 
hua.open "select * from snsn_hua where userid="&session("id"),conn,3,3
if not hua.eof then 
if hua("ax")<hua("max1")  then
if datediff("d",hua("axdate"),now)>=1 then
hua("dayax")=0
hua("axdate")=now()
hua.update
end if
if hua("dayax")<8 then
gwjga=3
if gwjga+hua("dayax")>8 then
gwjga=8-hua("dayax")
end if
hua("dayax")=hua("dayax")+gwjga
hua("ax")=hua("ax")+gwjga
hua.update

end if
end if
end if
'end 爱心

'今日更新
sql="select * from snsn_user where id="&web_id
Set rscount= Server.CreateObject("ADODB.Recordset") 
rscount.open sql,conn,1,1
if rscount.eof or rscount.bof then
response.write "<script language='javascript'>"
response.write "alert('没有此用户，请确认后或联系管理员再访问本页！');"
response.write"this.location.href='/index.asp';</SCRIPT>"
response.end
else

    if datediff("d",rscount("inewdate"),now())<1 then
	conn.execute("update snsn_user set inew=inew+1 where id="&web_id)
    else
	conn.execute("update snsn_user set inew=1,inewdate=getdate() where id="&web_id)
    end if
    
end if
rscount.close
set rscount=nothing
'结束

					

id=rs("id")
rs.close
set rs=nothing
session("lasttime")=now()
if classid=0 then
response.redirect "bbs.asp?web_id="&web_id
else
response.redirect "bbs_c.asp?web_id="&web_id&"&id="&classid
end if
else
%>
<html><head><title>欢迎访问论坛</title>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<SCRIPT language=JavaScript>

function CheckInput(){

if(snsn.title.value==''){
		alert("您没有填写主题！");
		snsn.title.focus();
		return false;
	}
	return true;
}
</SCRIPT>
<link rel="stylesheet" href="css.css" type="text/css">
</head>
<body bgcolor="#ffffff">
<form method="post" action="bbs_add.asp?web_id=<%=web_id%>&action=add"  name="snsn" onSubmit="return CheckForm(this);">
  <input name="body" type="hidden">
  <table width="420"  border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="1" height="1"></td>
      <td height="1" colspan="2" bgcolor="#CCCCCC"></td>
      <td width="1" height="1"></td>
    </tr>
    <tr>
      <td width="1" bgcolor="#CCCCCC"></td>
      <td width="30" bgcolor="#F1F1F1"><div align="center"><span class="M"><IMG 
                              src="img/icon_03.gif" 
                              name=image1754891 width="14" height="14" border=0></span></div></td>
      <td height="25" bgcolor="#F1F1F1"><span class="M"><FONT 
                              color=#000000><a href="web.asp?web_id=<%=web_id%>"><U><%=home%></U></a></FONT> -&gt; <FONT 
                              color=#000000><a href="bbs.asp?web_id=<%=web_id%>"><U><%=lt%></U></a></FONT> -&gt; <FONT 
                              color=#000000><a href="bbs_add.asp?web_id=<%=web_id%>"><U>发表新帖</U></a></FONT></span></td>
      <td width="1" bgcolor="#CCCCCC"></td>
    </tr>
    <tr>
      <td width="1" height="1"></td>
      <td height="1" colspan="2" bgcolor="#CCCCCC"></td>
      <td width="1" height="1"></td>
    </tr>
  </table>
  <div align="center"><br>
    <center>
      <table width="400" border="0" cellpadding="1" cellspacing="1" bgcolor="efefef">
        <tr bgcolor="#FFFFFF">
          <TD height=30 align="left" bgcolor="#FFFFFF">&nbsp;<B>帖子分类：</B>&nbsp;
            
            <select name="classid" size="1" id="classid"  class="wenbenkuang">
            <%Set rs1 = Server.CreateObject("ADODB.Recordset")

        rs1.open "select * from snsn_bbs_class where userid="&web_id&" order by id",conn,1,1
	if rs1.eof and rs1.bof then
%>  <option selected value="0">所有分类</option>
              <% 
	else
%>  <option selected value="0">所有分类</option>
              <option  value="<%=rs1("id")%>"><%=trim(rs1("bbsname"))%></option>
              <% 
        rs1.movenext
        do while not rs1.eof
%>
              <option value="<%=rs1("id")%>"><%=trim(rs1("bbsname"))%></option>
              <%
        rs1.movenext
        loop
	end if
        rs1.close
%>
            </select>
            <FONT                                                                                                                              
      color=#2953c0>*</FONT> </TD>
        </tr>
        <tr bgcolor="#FFFFFF">
          <TD height=30 align="left" bgcolor="#FFFFFF">&nbsp;<B>帖子主题：</B>&nbsp;
            <input type="text" name="title" maxlength="28" size="30" class=wenbenkuang>
            <FONT                                                                                                                              
      color=#2953c0>*</FONT> </TD>
        </tr><tr bgcolor="#FFFFFF">
          <TD height=25 align="left" bgcolor="#FFFFFF" title="如果使用魔法表情将不能使用文字秀功能">&nbsp;<B>魔法表情：</B>&nbsp;            <input name="show" type="text" class=wenbenkuang id="show" size="28" maxlength="28" readOnly>
          <a href="javascript:;" onClick="window.open('../qq/selqq.asp','web_show','scrollbars=no,resizable=no,width=370,height=365,menubar=no,top=188,left=188')" class=over>魔法表情浏览</a></TD>
        </tr>
        <tr bgcolor="#FFFFFF">
          <TD height="200" align="left" vAlign=top bgcolor="#FFFFFF"><SCRIPT src="post.js"></SCRIPT>          </TD>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="25" bgcolor="#FFFFFF" title="如果使用文字秀则发表的一些文字会被图片替代">
          
              &nbsp;
              <input name="submit1" type="submit" class="go-wenbenkuang" value="发 表"  onClick="return CheckInput();">

              <input name="return" type="button" class="go-wenbenkuang" onclick="javascript:history.go(-1)" value="返 回" >
          
          <input name="zshow" type="checkbox" id="zshow" value="1">
          是否使用文字秀&nbsp;· <a href="javascript:CheckLength();">查看内容长度</a>            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="6" bgcolor="#FFFFFF">&nbsp; &nbsp; &nbsp; 魔法表情和文字秀不能同时使用。</td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <td height="7" bgcolor="#FFFFFF">&nbsp; &nbsp; &nbsp; 使用文字秀将失去HTML功能。</td>
        </tr>
        <tr bgcolor="#FFFFFF">
          <TD height=53 align="left" bgcolor="#FFFFFF"><table width="98%"  border="0" align="center" cellpadding="5" cellspacing="0">
              <tr>
                <td><%For I=1 to 56%>
                  <input type="radio" name="faceimg" value="<%=i%>" checked><%
				  if   isempty(session("lasttime")) or   len(session("lasttime"))=0 then
				  session("lasttime")=now()
				  end if%>
                  <img src="img/Mood/<%=i%>.gif" width="20" height="20">
                  <%                               
Next                               
%></td>
              </tr>
            </table></TD>
        </tr>
      </table>
    </center>
  </div>
</form>
</body></html><%end if%>