⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xxnews_add_save.asp

📁 一个完全仿照阿里巴巴的网站管理系统 本软件没有版权问题
💻 ASP
字号:
<!--#include file="top.asp"-->
<%if userflag5=0 then
response.redirect"ok.asp?action=flag"
end if%>
<%title=request("title")
if userflag34<>1 then
news=code_jk(request("newss"))
else
For i = 1 To Request.Form("newss").Count 
	news = news & Request.Form("newss")(i) 
Next
end if
ly=request("ly")
addr=request("addr")
newssort=request("newssort")


page=request("page")
if page="" then page=1

if request("action")="del" then
conn.execute("delete from SMT_xxnews where SMT_id=" & request("id")&" and SMT_yp_id="&session("id"))
conn.execute("delete from SMT_leaveword where SMT_book_sort=6 and SMT_book_table="& request("id")&" and SMT_book_ypid="&session("id")&"")
Response.Redirect "ok.asp?url=xxnews.asp&page="&page

elseif request("action")="add" then
if title="" then
errstyle="·请输入完整的新闻标题!"
scripterr
end if
if news="" or len(news)<20 then
errstyle="·请输入不少于20个字符的新闻内容!"
scripterr
end if
if newssort="" then
errstyle="·请选择企业新闻所属栏目!"
scripterr
end if
if ly="" then
errstyle="·请输入新闻来源!"
scripterr
end if
if addr="" then
errstyle="·请输入新闻添加人!"
scripterr
end if

set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_xxnews where SMT_yp_id="& session("id")&" order by SMT_id desc"
rs.open sql,conn,1,3

if userflag5<>0 then
if rs.recordcount >= cint(userflag5) then
errstyle="·您是"&vipshow&",只能上传最多 "&userflag5&" 条行业新闻!"
scripterr
end if
else
errstyle="·对不起,此功能已对"&vipshow&"关闭!"
scripterr
end if

rs.addnew
rs("SMT_title")=title
rs("SMT_news")=news
rs("SMT_ly")=ly
rs("SMT_addr")=addr
rs("SMT_newssort")=newssort
rs("SMT_key1")=cityxxkey
rs("SMT_yp_id")=session("id")
rs.update

SMT_id=rs("SMT_id")

rs.close
set rs=nothing

if application("cityHTML")=1 then
call savehtml(SMT_id)
end if

if cityxxkey=1 then
response.redirect"ok.asp?url=xxnews_add.asp"
else
response.redirect"ok.asp?url=xxnews_add.asp&key=yes"
end if

elseif request("action")="edit" then
if title="" then
errstyle="·请输入完整的新闻标题!"
scripterr
end if
if news="" or len(news)<20 then
errstyle="·请输入不少于20个字符的新闻内容!"
scripterr
end if
if newssort="" then
errstyle="·请选择企业新闻所属栏目!"
scripterr
end if
if ly="" then
errstyle="·请输入新闻来源!"
scripterr
end if
if addr="" then
errstyle="·请输入新闻添加人!"
scripterr
end if

set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_xxnews where SMT_id="&request("id")&" and SMT_yp_id="&session("id")
rs.open sql,conn,1,3
if userflag5=0 then
errstyle="·对不起,此功能已对"&vipshow&"关闭!"
scripterr
end if

rs("SMT_title")=title
rs("SMT_news")=news
rs("SMT_ly")=ly
rs("SMT_addr")=addr
rs("SMT_newssort")=newssort
rs("SMT_key1")=cityxxkey
rs.update
rs.close
set rs=nothing

if application("cityHTML")=1 then
call savehtml(request("id"))
end if

if cityxxkey=1 then
response.redirect"ok.asp?url=xxnews_add.asp&page="&page
else
response.redirect"ok.asp?url=xxnews_add.asp&key=yes&page="&page
end if

elseif request("action")="key" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from SMT_xxnews where SMT_id="&request("id")&" and SMT_yp_id="&session("id")
rs.open sql,conn,1,3

rs("SMT_key")=request("zt")
rs.update
rs.close
set rs=nothing
response.redirect"ok.asp?url=xxnews.asp&page="&page
end if

'=======================================
function savehtml(id)

set rs=server.createobject("adodb.recordset")
set rs1=server.createobject("adodb.recordset")
set fso=server.CreateObject("Scripting.FileSystemObject")
sql="select * from SMT_xxnews where SMT_id="&id&""
rs.open sql,conn,1,1
if rs.eof then
response.write "<br><br><div align=center>此内容不存在</div>"
response.end
else
ypid=rs("SMT_yp_id")
title=rs("SMT_title")
news=rs("SMT_news")
newssort=rs("SMT_newssort")
ly=rs("SMT_ly")
addr=rs("SMT_addr")
addsj=rs("SMT_date")

Ftitle=""
if ly<>"" then Ftitle="来源:"&ly&""
if addr<>"" then Ftitle=Ftitle&" 添加人:"&addr&""
if addsj<>"" then Ftitle=Ftitle&" 添加时间:"&addsj&""

end if
rs.close

folder=year(addsj)&month(addsj)
filename=replace(replace(replace(addsj,"-",""),":","")," ","")&".html"

shtml="<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN""><html><head>"&_
      "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"&_
	  "<title>"&title&" - "&application("citytitle")&"</title></head>"&application("citycss")&"<body topmargin=0>"&_
	  "<script language=javascript src="&application("cityurl")&"Include/top.asp></script>"&_
	  "<table width=760 border=0 cellspacing=0 cellpadding=0 align=center>"

sql1="select * from SMT_xxnewssort where SMT_id="&newssort
rs1.open sql1,conn,1,1
if not rs1.eof then
newssortview=" >> <a href="&application("cityurl")&"new_list.asp?id="&rs1("SMT_id")&">"&rs1("SMT_newssort")&"</a>"
else
newssortview=""
end if
rs1.close

shtml=shtml&"<tr><td width=580 valign=top><table width=""98%"" border=0 cellspacing=1 cellpadding=0 align=center>"&_
      "<tr><td height=30>当前位置:<a href="&application("cityurl")&"index.asp>首页</a> >> <a href="&application("cityurl")&"news.asp>行业新闻</a>"&newssortview&" >> 正文</td></tr>"&_
      "<tr><td height=5></td></tr><tr><td height=40 align=center class=f18><strong>"&title&"</strong></td></tr>"&_
      "<tr><td align=right>"&_
      "<table width=""100%"" border=0 cellspacing=0 cellpadding=5>"&_
      "<tr><td align=right><img src="&application("cityurl")&"img/item.gif border=0 align=absmiddle> <a onclick=""window.print()"" style=""cursor:hand"">我要打印</a>"&_
      "&nbsp;<img src="&application("cityurl")&"img/collection.gif border=0 align=absmiddle> <a href=# onClick=""javascript:window.external.AddFavorite('"&application("cityurl")&"Html/xxnews/"&folder&"/"&filename&"','"&title&"');return false"">IE收藏</a>"&_
      "&nbsp;<img src="&application("cityurl")&"img/gwb.gif border=0 align=absmiddle> <a href=# onClick=""javascript:window.open('"&application("cityurl")&"collection.asp?tit="&title&"&page=Html/xxnews/"&folder&"/"&filename&"','_n','width=300,height=150');return false"">放入公文包</a>"&_
      "&nbsp;<img src="&application("cityurl")&"img/icon_info_01.gif border=0 align=absmiddle> <a href=#book>我要留言</a> "&_
      "&nbsp;<img src="&application("cityurl")&"img/icon_info_02.gif border=0 align=absmiddle> <a href=#view>查看留言</a>&nbsp;"&_
      "</td></tr></table>"&_
      "</td></tr>"&_
      "<tr><td height=22 align=center bgcolor=388DFE><font color=#ffffff>"&Ftitle&"</font></td></tr>"&_
      "<tr><td height=10></td></tr>"&_
      "<tr><td height=300 valign=top><p style=""line-height:190%"" class=f14>"&news&"</td></tr>"&_
      "<tr><td height=20></td></tr>"&_
      "<tr><td><table width=""100%"" border=0 cellspacing=1 cellpadding=5 bgcolor=#388DFE>"&_
      "<tr><td width=""50%""><font color=white><strong>最新供应信息</strong></font></td>"&_
      "<td width=""50%""><font color=white><strong>最新求购信息</strong></font></td></tr>"&_
      "<tr bgcolor=#ffffff><td><script language=javascript src="&application("cityurl")&"Include/sca.asp?aid=3&bid=6&cid=26&did=1&eid=1&fid=1></script></td>"&_
      "<td><script language=javascript src="&application("cityurl")&"Include/sca.asp?aid=2&bid=6&cid=26&did=1&eid=1&fid=1></script></td></tr>"&_
      "</table></td></tr>"&_

      "<a name=view></a><tr><td height=5></td></tr>"&_
      "<tr><td><table width=""100%"" border=0 cellspacing=1 cellpadding=5 bgcolor=388DFE>"&_
      "<tr><td><font color=white><strong>查看留言</strong></font></td></tr>"&_
      "<tr><td bgcolor=#ffffff height=20><script language=javascript src="&application("cityurl")&"Include/leaveword_view.asp?sortid=7&tableid="&id&"></script></td></tr>"&_
      "</table></td></tr>"&_
	  
	  "<a name=book></a><tr><td height=5></td></tr>"&_
      "<tr><td><table width=""100%"" border=0 cellspacing=1 cellpadding=5 bgcolor=388DFE>"&_
      "<tr><td><font color=white><strong>用户留言</strong></font></td></tr>"&_
      "<tr><td bgcolor=#ffffff><script language=javascript src="&application("cityurl")&"Include/leaveword.asp?sortid=7&tableid="&id&"&ypid="&ypid&"></script></td></tr>"&_
      "</table></td></tr>"&_

      "</table></td>"&_

      "<td width=180 valign=top bgcolor=#efefef>"&_
      "<table width=""100%"" border=0 cellspacing=0 cellpadding=3>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14> <strong><font color=#ffffff>站内搜索</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/search.asp?search=2></script></td></tr>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14> <strong><font color=#ffffff>企业动态</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/news.asp?aid=0&bid=8&cid=24&did=0&eid=0&fid=1&gid=0></script></td></tr>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14> <strong><font color=#ffffff>产品推荐</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/cp.asp?aid=1&bid=4&cid=20&did=1&eid=1&fid=80></script></td></tr>"&_
      "<tr><td height=25 background="&application("cityurl")&"img/bgtitle.gif class=f14> <strong><font color=#ffffff>行业动态</font></strong></td></tr>"&_
      "<tr><td><script language=javascript src="&application("cityurl")&"Include/news.asp?aid=1&bid=20&cid=20&did=1&eid=0&fid=1&gid=0></script></td></tr>"&_
      "</table>"&_

      "</td></tr></table>"&_

      "<table width=760 border=0 cellspacing=0 cellpadding=0 align=center bgcolor=#ffffff>"&_
      "<tr><td height=10></td></tr>"&_
      "<tr><td height=2 bgcolor=#4795EC></td></tr>"&_
      "<tr><td align=center height=80><script language=javascript src="&application("cityurl")&"Include/bottom.asp></script></td></tr></table>"&_

      "</body></html>"
path=server.MapPath("../Html/xxnews/"&folder)
if fso.FolderExists(path)=false then
fso.CreateFolder(path)
end if
path=path&"/"&filename

set ts=fso.OpenTextFile(path,2,true,-2)
   ts.writeline""&shtml&""
   ts.close
set ts=nothing
set fso=nothing
set rs1=nothing
set rs=nothing

end function

%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -