<!--#include file="../Inc/Function.asp" -->
<!--#include file="../Inc/Cls_DB.asp" -->
<!--#include file="../Inc/Const.asp" -->
<% dim  dbc,conn
   set  dbc=new databaseclass
   set  conn=dbc.openconnection()
   set  dbc=nothing
   %>
<!--#include file="../Inc/MemberCheck.asp" -->
<%
  Set Rsconfig=Server.CreateObject("Adodb.RecordSet")
    Sqlconfig="Select * from config"
    Rsconfig.open Sqlconfig,conn,1,3

  
	
Dim NewsContent
NewsContent = Replace(Replace(Request.Form("Content"),"""","%22"),"'","%27")
%>
<html>
<link href="../CSS/css.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>会员投稿</title><body>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr bgcolor="#EFEFEF"> 
          <td width="26" height="32">&nbsp;</td>
          <td width="445"><b><font color="#000000"><b>会员投稿</b></font></b></td>
          <td width="96"><div align="center"><a href="Usermain.asp">会员中心首页 </a></div></td>
          <td width="72"><div align="center"><a href="Logout.asp"><font color="#FF0000">安全退出</font></a></div></td>
          <td width="9"></td>
        </tr>
      </table></td>
  </tr>
</table>
<br>
<table width="80%" border="0" align="center" cellpadding="6" cellspacing="1" bgcolor="#CCCCCC">
<form action="" method="POST" name="NewsForm">
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#31295;&#20214;&#26631;&#39064;
          <input name="Title" id="Title" style="width:50% ">
      </div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#21103; &#26631; &#39064;
          <input name="SubTitle" id="SubTitle" style="width:50% ">
      </div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#20851; &#38190; &#23383;
          <input name="KeyWords" type="text" id="KeyWords" style="width:22% ">
          &nbsp; &nbsp;&nbsp; 
      &#20316;&#32773;
      <input name="Author" type="hidden" style="width:21% " value="<%=session("memname")%>"><input name="Author" type="text" style="width:21% " value="<%=session("memname")%>" disabled>
</div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"> <div align="center">&#25152;&#23646;&#26639;&#30446;
          <select name="ClassID" id="ClassID" style="width:50% ">
	   <%
	   Dim UserAddRikerObj
	   Set UserAddRikerObj = Conn.Execute("Select ClassID,ClassCName from NewsClass where DelFlag=0 and Contribution=1 order by AddTime desc")
	   Do While Not UserAddRikerObj.eof
	   %>
	   <option value="<%=UserAddRikerObj("ClassID")%>"><%=UserAddRikerObj("ClassCName")%></option>
	   <%
	   	UserAddRikerObj.MoveNext
	   Loop
	   UserAddRikerObj.Close
	   Set UserAddRikerObj = Nothing
	   %>
		  </select>
</div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"><div align="center"> 
          <iframe id='NewsContent' src='Editer/NewsEditer.asp' frameborder=0 scrolling=no width='100%' height='360'></iframe>
        </div></td>
    </tr>
    <tr bgcolor="e6e6e6"> 
      <td colspan="3"><div align="center"> 
          <input name="submitggg" type="button" onClick="SubmitFun();" value=" &#25552; &#20132; ">
          <input name="reset" type="reset" value=" &#22797; &#20301; ">
          <input type="hidden" name="Content" value="<% = NewsContent %>">
          <input name="action" type="hidden" id="action" value="add">
      </div></td>
    </tr></form>
  <tr>
    <td bgcolor="#DFDFDF">
<div align="center">
        <p >
		<%
		Dim Rsconfig
		set Rsconfig=conn.execute("select * from config")
		Response.Write(""&Rsconfig("Copyright")&"")
		Rsconfig.close
		set Rsconfig=nothing
		%></p>
      </div></td>
  </tr>
  </table>

</body></html>
<script>
function SubmitFun()
{
	frames["NewsContent"].SaveCurrPage();
	var TempContentArray=frames["NewsContent"].NewsContentArray;
	document.NewsForm.Content.value='';
	for (var i=0;i<TempContentArray.length;i++)
	{
		if (TempContentArray[i]!='')
		{
			if (document.NewsForm.Content.value=='') document.NewsForm.Content.value=TempContentArray[i];
			else document.NewsForm.Content.value=document.NewsForm.Content.value+'[Page]'+TempContentArray[i];
		} 
	}
	document.NewsForm.submit();
}
</script>
<% if request.form("action")="add" then
		if Replace(Replace(Replace(request.form("Title"),"'",""),"\",""),"/","")="" or request.form("Content")="" then
			Response.Write("<script>alert(""请填写稿件标题和内容"");location=""javascript:history.back(1)"";</script>")  
			Response.End
		end if
		if Cstr(Request.Form("ClassID")) = "" then
			Response.Write("<script>alert(""请选择投稿栏目"");location=""javascript:history.back(1)"";</script>")  
			Response.End
		end if
	  set rs = server.createobject("adodb.recordset")
	  sql1 = "select * from Contribution where 1=0"
	  rs.open sql1,conn,1,3
	  rs.addnew
	  rs("ContID") = GetRandomID18()
	  rs("Title")=Replace(Replace(Replace(request.form("Title"),"'",""),"\",""),"/","")
	  If Replace(request.form("SubTitle"),"'","")<>"" then
		  rs("SubTitle")=Replace(request.form("SubTitle"),"'","")
	  End if
	  rs("Content")=request.Form("Content")
	  rs("AddTime")=now()
	  rs("KeyWords")=Replace(request.form("KeyWords"),"'","")
	  rs("Author")=Replace(Request.Form("Author"),"'","")
	  rs("ClassID")=Cstr(Request.Form("ClassID"))
	  rs.update
	  conn.execute("update members set ConNum=ConNum+1 where MemName='"&Replace(Replace(Request.Form("Author"),"""",""),"'","")&"'")
	  Response.Write("<script>if (confirm(""投稿成功,是否继续投稿?"")==false) window.location=""UserMain.asp""; else window.location=""?ClassID="&ClassID&""";</script>")
	  Response.End
	  rs.close()
	  set rs=nothing
  end if
  %>
