<!--#include file="../inc/config.asp"-->
<!--#include file="../Inc/Check_Login.asp"-->
<%
dim action
action=request("action")
a9_title=request("a9_title")
A9_Form=request("A9_Form")
A9_KeyWord=request.form("A9_KeyWord")
A9_DescWord=request.form("A9_DescWord")
a9_content=request("a9_content")
a9_User=request("a9_User")
a9_Userid=request("a9_Userid")
verifycode=request("verifycode")

if action="add" then
sql="select * from a9_User where a9_Userid="&a9_Userid&""
	rs.open sql,conn,1,1
If session("username") <> Rs("a9_User") Then
	response.Write "<script language='javascript'>alert('非法操作！');history.go(-1);</script>"
	response.end
end if

if a9_title="" or a9_content="" then
	Response.Write ("<script language=javascript>alert('文章标题，文章内容不能为空');history.back(-1);</script>")
	response.end
end if

if cstr(session("checkcode"))<>verifycode then
	response.write "<script language='javascript'>alert('请输入正确的验证码！');history.go(-1);</script>"
	response.end
end if

	set rs=server.CreateObject("adodb.recordset")
	sql="Select * From [a9_user] where a9_user='"&a9_User&"'and a9_Pass='"&session("password")&"'"
	rs.open sql,conn,1,3
	
if DateDiff("n",rs("a9_lastTime"),now())<480 then
	response.write"<SCRIPT language=JavaScript>alert('网站限制普通会员八小时内只能发布一次文章！');history.back(-1);</SCRIPT>"
        response.end
end if

	a9_points=rs("a9_points")
	if a9_points>4 then
	rs("A9_Points")=rs("A9_Points")-5
	rs("A9_lastTime")=Now()
	session("Points")=rs("A9_Points")
	
		set rs=server.createobject("adodb.recordset")
		rs.open "select * From a9_news",conn,1,3
		rs.addnew
		rs("a9_title")=a9_title
		rs("A9_Form")=A9_Form
		rs("A9_KeyWord")=A9_KeyWord
		rs("A9_DescWord")=A9_DescWord
		rs("a9_content")=a9_content
		rs("a9_User")=a9_User
		rs("a9_Userid")=a9_Userid
		rs("a9_time")=now()

	rs.update
	rs.close
		set rs=nothing 
		response.write ("<script language=javascript>alert('恭喜你，文章发布请等待审核！');this.location.href='Index.rhtml';</script>")
		response.end
	else
		rs.close
		set rs=nothing
		response.write ("<script language=javascript>alert('你的a9币不够！不能进行文章发布！');this.location.href='Index.rhtml';</script>")
		response.end
		end if

end if
%>
<!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" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>文章发布 - <%=PeakJo("A9_WebName")%></TITLE>
<meta name="Keywords" content="<%=PeakJo("A9_WebKey")%>" />
<meta name="Description" content="<%=PeakJo("A9_WebDesc")%>" />
<link type="text/css" rel="stylesheet" href="/Content/Css/Style.css" />
</head>
<body>
<!-- 顶部开始 header -->
<!--#include file="../Header.asp"-->
<!-- 顶部结束 header -->
    <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" class="User_Table">
<form action="?action=add" method="post" name="form1">
  <tr>
     <th height="30">标题：</th>
    <td><input name="a9_title" type="text" size="45" class="LoginTxt"></td>
  </tr>
  <tr>
     <th height="30">来源：</th> 
    <td><input name="A9_Form" type="text"  size="45" value="<%=PeakJo("a9_webname")%>" class="LoginTxt"> 写网站名称，如：<%=PeakJo("a9_webname")%></td>
  </tr>
  <tr>
     <th height="30">关键词：</th>    
    <td><input name="A9_KeyWord" type="text" size="45" class="LoginTxt"> 用,分割</td>
  </tr>
  <tr>
     <th height="30">描述：</th>    
    <td><textarea id="A9_DescWord" name="A9_DescWord" cols="80%" rows="5" class="LoginTxt"></textarea> 
    限制180字以内</td>
  </tr>
  <tr>
    <th>内容</th>  
    <td><textarea id="content" name="a9_content" style="display:none"></textarea>
<iframe id="Editor" name="Editor" src="/Content/Editor/edit.html?ubb=1&amp;id=a9_content" frameborder="0" marginheight="0" marginwidth="0" scrolling="No" style="height:400px;width:100%"></iframe></td>
  </tr>
  <tr>
     <th height="30">验证码</th> 
    <td><input name="verifycode" type="text" id="verifycode" maxlength="20" class="LoginTxt" />
	<img src='/inc/GetCode.Asp' align='absmiddle' border='0' alt="验证码,看不清楚?请点击刷新验证码" style="cursor : pointer;" onclick="this.src='/inc/GetCode.Asp'"></td>
  </tr>
<input name="a9_User" type="hidden" value="<%=session("username")%>"/> 
<input name="a9_UserID" type="hidden" value="<%=session("userid")%>"/> 
  <tr>
    <td colspan="2" height="30" align="center" class="l-login">　
        <input type="submit" class="login" value="确认提交"/></td>
    </tr>
  </form>
</table>
  <!-- 底部开始 footer -->
<!--#include file="../Bottom.asp"-->
<!-- 底部结束 footer -->
</body>
</html>