<!--#include file="conn.asp"-->
<%if session("admin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
else
if session("flag")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限！</b></font></div>"
response.End
end if
end if

function changechr(str) 
    changechr=replace(replace(replace(replace(str,"<","&lt;"),">","&gt;"),chr(13),"<br>")," "," ") 
    changechr=replace(changechr,"'","&quot;")
    changechr=replace(changechr,mid(" "" ",2,1),"&quot;")
end function

newsid=request("newsid")

Content=Request.Form("Content")

'将里面的链接换成本地链接
 aa="http://"&Request.ServerVariables("server_name")&Request.ServerVariables("path_info")
 aa= mid(aa,1,len(aa)-22)		'22=admin/zhuantiedit2.asp
content=replace(content,aa,"")

session("content")=content

if Content=""  then
%>
<script language=javascript>
history.back()
alert("请输入文章内容！")
</script>
<%
Response.End
end if

title=request.form("title")
if title="" then
%>
<script language=javascript>
history.back()
alert("请填写文章标题！")
</script>
<%
Response.End
end if

if len(title)>100 then
%>
<script language=javascript>
history.back()
alert("文章标题过长！")
</script>
<%
Response.End
end if
title=changechr(trim(request.form("title")))
if title_color="0" then
	title_color="#003399"
end if
title_size=Request.Form("title_size")
if title_size="0" then
	title_size="5"
end if
title_type=Request.Form("title_type")
if title_type="0" then
	title_type="b"
end if
title_face=Request.Form("title_face")
if title_face="0" then
	title_face="楷体_GB2312"
end if

set rs=server.createobject("adodb.recordset")
sql="select * From shop_zhuanti where NewsID=" & NewsID
rs.open sql,conn,1,3

rs("title")=title
rs("content")=content
rs("UpdateTime")=now()
rs("titletype")=title_type
rs("titlesize")=title_size
rs("titlecolor")=title_color
rs("titleface")=title_face
rs.update

rs.Close
set rs=nothing

'set rs3=server.createobject("adodb.recordset")
 '   sql3="select * from uploadpic where username='"&username&"'" 
  '  rs3.open sql3,dataconn,1,3
   ' do while not rs3.eof
    'set rs4=server.createobject("adodb.recordset")
     '      sql4="select * from attach" 
      '     rs4.open sql4,dataconn,1,3
       '    filename=rs3("picname")
        '   rs4.addnew
         '  rs4("filename")=filename
          ' rs4("newsid")=newsid
          ' rs4.update
          ' rs4.close
          ' set rs4=nothing
          ' RS3.MoveNext
          ' loop
          ' dataconn.execute("delete from uploadpic where username='"&username&"'")
          ' rs3.close
          ' set rs3=nothing
session("content")=""


conn.close
set conn=nothing
'session("filename")=""
%>
<script language="javascript">
window.alert("文章修改成功!");
window.location.href="<%=request("linkaddress")%>";
//window.close();
</script>