<!--#include file="../conn/conn2.asp" -->
<!--#include file="../conn/function.asp" -->
<!--#include file="member_check.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="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心</title>
<style type="text/css">

			html {
				overflow:auto;
			}
			body {
			margin:0px;
				
				font-size:12px;
				line-height:180%;
				font-family:"微软雅黑";
				background:url(images/login_bgx.gif);
				
			}
			a img {
	border:none;
}
			a{ font-size:12px; color:#000000; text-decoration:none;}
			a:hover {color:#0066ff;text-decoration: underline}
			.input {border-top:1px solid #ABADB3;border-left:1px solid #ABADB3;border-right:1px solid #ddd;border-bottom:1px solid #ddd;height:24px;width:300px;padding:0 5px;}
.container{width:1100px; height:600px; position:absolute; top:50%; left:50%; margin-left:-550px; margin-top:-300px; background:#FFFFFF;box-shadow:0px 0px 20px #999999;}
table{ border-collapse:collapse;}
table tr td{ border-bottom:1px solid #dedede; line-height:150%; padding:10px;}
.input1 {border-top:1px solid #ABADB3;border-left:1px solid #ABADB3;border-right:1px solid #ddd;border-bottom:1px solid #ddd;height:24px;width:400px;padding:0 5px;}
.input2 {border:1px solid #FFB334;outline:2px solid #ffdc97;*border:2px solid #FFB334;*padding:2px 5px;height:24px;width:400px;padding:0 5px;}
</style>
</head>
<body>
<%
action=Request.QueryString("action")
N_id=Request.QueryString("N_id")

if N_id<>"" then
aa="edit&N_id="&N_id
sql="Select * from SL_news Where N_id="&N_id
		set rs=Server.CreateObject("ADODB.RecordSet")
		rs.open sql,conn,1,1
		if not rs.eof then
		N_title=rs("N_title")
		
		N_view=rs("N_view")
		N_content=rs("N_content")
		N_short=rs("N_short")
		N_pic=rs("N_pic")
		N_sort=rs("N_sort")
		N_date=rs("N_date")
		N_top=rs("N_top")
		end if
		rs.close
set rs=nothing
else
aa="add"
N_date=now()
end if
N_author=session("M_login")
if action="add" then
N_title=Request.Form("N_title")
N_author=Request.Form("N_author")
N_view=Request.Form("N_view")
N_date=Request.Form("N_date")
N_content=Request.Form("N_content")
N_pic=Request.Form("N_pic")
N_sort=Request.Form("N_sort")
N_top=Request.Form("N_top")
if Request.Form("N_short")="" then
N_short=left(LoseHtml(N_content),200)
else
N_short=Request.Form("N_short")
end if

if left(N_pic,5)="media" then
N_pic=N_pic
else
N_pic="media/"&N_pic
end if

if N_view="" then
N_view=0
end if

if N_title<>"" and N_content<>"" and N_pic<>"" and N_sort<>"" then

sql="Select * from SL_news"
		set rs=Server.CreateObject("ADODB.RecordSet")
		rs.open sql,conn,1,3
		rs.addnew
		rs("N_title")=N_title
		rs("N_author")=session("M_login")


		rs("N_content")=N_content
		rs("N_short")=N_short

		rs("N_sort")=N_sort
		rs("N_date")=N_date
		rs("N_sh")=2
		rs("N_pic")="media/20151019213836856.jpg"

		rs.update
		rs.close
		
call box("添加新闻成功!","member_news.asp","success")
response.End()
else
call box("请填全信息！","back","error")
response.End()
end if
end if
if action="edit" then
N_title=Request.Form("N_title")
N_author=Request.Form("N_author")
N_view=Request.Form("N_view")
N_date=Request.Form("N_date")
N_content=Request.Form("N_content")
N_pic=Request.Form("N_pic")
N_sort=Request.Form("N_sort")
N_top=Request.Form("N_top")
if Request.Form("N_short")="" then
N_short=left(LoseHtml(N_content),200)
else
N_short=Request.Form("N_short")
end if
if left(N_pic,5)="media" then
N_pic=N_pic
else
N_pic="media/"&N_pic
end if
if N_view="" then
N_view=0
end if

if N_title<>"" and N_content<>"" and N_sort<>"" then
sql="Select * from SL_news Where N_id="&N_id
		set rs=Server.CreateObject("ADODB.RecordSet")
		rs.open sql,conn,1,3
		if not rs.eof then
		rs("N_title")=N_title
		rs("N_content")=N_content
		rs("N_short")=N_short
		rs("N_sort")=N_sort
		rs("N_date")=N_date
		rs("N_sh")=2

		rs.update
		rs.close
		end if
call box("修改新闻成功!","member_news.asp","success")
response.End()
else
call box("请填全信息！","back","error")
response.End()
end if
end if
%>
<div class="container">
<!--#include file="left.asp" -->
<div style="position: relative; padding:20px 20px 20px 220px;">
<div style="height:580px;overflow:auto">
<h2>我的投稿</h2>
<hr>
<form id="form" name="form1" method="post" action="?action=<%=aa%>" onsubmit="return check();">
<table width="100%">
<tr><td width="12%">新闻标题：</td><td><input type="text" name="N_title" value="<%=N_title%>" class="input1" onFocus="this.className='input2'" onBlur="this.className='input1'"/></td></tr>
<tr><td width="12%">新闻作者：</td><td><input type="text" name="N_author" value="<%=N_author%>" class="input1" onFocus="this.className='input2'" onBlur="this.className='input1'"/></td></tr>
<tr><td width="12%">发布时间：</td><td><input type="text" name="N_date" value="<%=N_date%>" class="input1" onFocus="this.className='input2'" onBlur="this.className='input1'"/></td></tr>
</table>
<%
call content("N_content",N_content)
%>
<table width="100%">

<tr><td width="12%">新闻分类：</td><td><select name="N_sort">
			<%
				sql1="Select S_title,S_id from SL_nsort"
				set rs1=Server.CreateObject("ADODB.RecordSet")
				rs1.open sql1,conn,1,1
				if not rs1.eof then
				for i=1 to rs1.recordcount
			%>
				<option value="<%=rs1("S_id")%>" <%if cstr(rs1("S_id"))=cstr(N_sort) then%>selected="selected"<%end if%>><%=rs1("S_title")%></option>
			<%
				rs1.movenext
				next
				end if
				rs1.close
				set rs1=nothing
			%>
			  </select></td></tr>
<tr><td width="12%"></td><td><input name="Submit" type="submit" class="submit" onmouseover="this.className='submit2'" onmouseout="this.className='submit'"  value="确 认" /></td></tr></table>
</form>

</div>
</div>
</div>
</body>
</html>