<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>投稿</title>
<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
body,td,th,input {
	font-size: 12px;
}
-->
</style>
<script type="text/javascript">
function check(obj){
	if(obj.title.value==""){
		alert("标题不能为空!")
		obj.title.focus();
		return false;
	}
	if(obj.content.value==""){
		alert("内容不能为空!")
		obj.content.focus();
		return false;
	}
	
	return true;
}
</script>
</head>

<body>
<%
dim act
act=request.querystring("act")
if(act="do") then
	dim author,classid,newsfrom,title,content
	'读取参数
	classid=Cint(request.form("classid"))
	author=request.form("author")	
	author=tohtml(author)
	author=gotTopic(author,25)
	
	newsfrom=request.form("newsfrom")	
	newsfrom=tohtml(newsfrom)
	newsfrom=gotTopic(newsfrom,125)
	
	title=request.form("title")	
	title=tohtml(title)
	title=gotTopic(title,125)
	
	content=request.form("content")	
	if(len(content)>1500) then
		call alertstr("内容字数超出(限1500个字符)"&len(content),1)
	else
		content=tohtml(content)	
	end if	
	
	dim current_time,current_M,current_D,tempid,file_path
	current_time=now()
	current_M=chan_data(current_time)
	current_D=chan_day(current_time)	
	tempid=chan_file(current_time)	
	file_path="html"&"/"&current_M&"/"&current_D&"/"&tempid&"."&FileExt
	'添加到库
	set rs=server.CreateObject("adodb.recordset") 
	rs.open "select top 1 * from news where 1=0",conn,3,3
	rs.addnew	
	rs("pagepath")=file_path
	rs("title")=title
	rs("title2")=title
	rs("title_color")=""
	rs("isoutlink")=0
	rs("keywords")=title
	rs("relate_key")=""
	rs("photo")=""
	rs("content")=content
	rs("parentid")=parentid
	rs("classid")=classid
	rs("specialid")=0
	rs("templetid")=GatherTempletId
	rs("top1")=0
	rs("totop")=0
	rs("tohot")=0
	rs("author")=author
	rs("news_edit")=""
	rs("news_from")=newsfrom
	rs("imgnews")=false
	rs("checked")=false
	rs("recommend")=false
	rs("moditime")=current_time	
	rs.update
	rs.close
	set rs=nothing	
	response.write("<p align=""center"">成功投稿，谢谢您的参与!<a href=""/"">返回</a></p>")
else
%>
<form id="form1" name="form1" method="post" action="?act=do" onsubmit="return check(this)">
  <table width="760" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td height="22" colspan="2" bgcolor="#A2B1CC"><div align="center" class="style1">在线投稿</div></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><div align="center">栏目：</div></td>
      <td bgcolor="#FFFFFF">
	  <select name="classid" id="classid">
	  <%
		set rs=server.CreateObject("adodb.recordset") 
		rs.open "select id,title from catalogs where sortid=1",conn,3,1
		while not rs.eof
			response.write("<option value="""&rs(0)&""">"&rs(1)&"</option>"&Chr(10))
			rs.movenext
		wend
		rs.close
		set rs=nothing
	  %>
      </select>      </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><div align="center">作者：</div></td>
      <td bgcolor="#FFFFFF"><input name="author" type="text" id="author" size="15" maxlength="20" /></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><div align="center">来源：</div></td>
      <td bgcolor="#FFFFFF"><input name="newsfrom" type="text" id="newsfrom" size="15" maxlength="20" /></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><div align="center">标题：</div></td>
      <td bgcolor="#FFFFFF"><input name="title" type="text" size="40" /></td>
    </tr>
    <tr>
      <td valign="top" bgcolor="#FFFFFF"><div align="center">内容：</div></td>
      <td bgcolor="#FFFFFF"><textarea name="content" id="content" style="width:100%; height:200px;"></textarea>
      限1500字以内</td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF">&nbsp;</td>
      <td bgcolor="#FFFFFF"><input type="submit" name="Submit" value="填好了，现在提交=&gt;" />
      <input type="reset" name="Submit2" value="重新填写" /></td>
    </tr>
  </table>
</form>
<%
end if
%>
</body>
</html>
<%
call connclose()
%>