📄 setunregulate.asp
字号:
<% Option Explicit %>
<!--#include file="../../../Inc/Cls_DB.asp" -->
<!--#include file="../../../Inc/Const.asp" -->
<!--#include file="../../../Inc/Function.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../../Inc/Session.asp" -->
<!--#include file="../../../Inc/CheckPopedom.asp" -->
<%
Dim NewsID,MainNewsID,Action
NewsID = Replace(Request.Form("NewsID")," ","")
MainNewsID = Request.Form("MainNewsID")
Action = Request.QueryString("Action")
If Not IsNumeric(NewsID) or NewsID="" Then
Response.write "<script>alert('错误的参数');history.back();</script>" : Response.End
End If
If Not IsNumeric(MainNewsID) or MainNewsID="" Then
Response.write "<script>alert('错误的主新闻参数');history.back();</script>" : Response.End
End If
'取从表单传入的数据
Dim tmp,NewsIndexTitle,tmpNewsID,FormName
for each tmp in split(NewsID,",")
FormName = "File_"&tmp
NewsIndexTitle = NewsIndexTitle & "," & Replace(Request.Form(FormName),",",",")
next
Dim Rs
Set Rs = Server.CreateObject(G_FS_Rs)
Rs.open "select MainUnregNewsID From [FS_UnRGLNews] Where UnregulatedMain='"&MainNewsID&"'",Conn,1,1
If Not Rs.eof Then tmpNewsID = Rs.GetString(,,"",",","")
Rs.Close
Set rs = Nothing
If tmpNewsID<>"" Then tmpNewsID = Left(tmpNewsID,Len(tmpNewsID)-1)
Call UpdateUnRGLNews(tmpNewsID,NewsID,MainNewsID,NewsIndexTitle)
set conn = nothing
Response.write "<script>alert('操作成功');location.href='UnRegulateList.asp';</script>"
'根据不规则原NewsID更新相关数据
Sub UpdateUnRGLNews(str1,str2,NewsID,IndexTitle)
Dim AddNewsID,DelNewsID,tmp,tmpIndexTitle,i
tmpIndexTitle = split(IndexTitle,",")
'寻找新添的新闻ID
for each tmp in split(str1,",")
if Instr(","&str2&",",","&tmp&",")=0 Then DelNewsID = DelNewsID & "," & tmp
next
'寻找去掉的关键字
for each tmp in split(str2,",")
if Instr(","&str1&",",","&tmp&",")=0 Then AddNewsID = AddNewsID & "," & tmp
next
If DelNewsID<>"" Then
DelNewsID = Replace(mid(DelNewsID,2),",","','")
Conn.Execute("Delete From [FS_UnRGLNews] Where UnregulatedMain='"&NewsID&"' and MainUnregNewsID in ('"&DelNewsID&"')")
End If
i = 0
for each tmp in split(AddNewsID,",")
if tmpIndexTitle(i)="" Then tmpIndexTitle(i)="未设定"
if tmp<>"" then Conn.Execute("Insert Into [FS_UnRGLNews](UnregulatedMain,MainUnregNewsID,NewsIndexTitle,AddDate) values('"&NewsID&"','"&tmp&"','"&tmpIndexTitle(i)&"','"&Now&"')")
i= i + 1
next
i = 1
for each tmp in split(str2,",")
if tmpIndexTitle(i)="" Then tmpIndexTitle(i)="未设定"
if tmp<>"" then Conn.Execute("update [FS_UnRGLNews] set NewsIndexTitle='"&tmpIndexTitle(i)&"' where MainUnregNewsID='"&tmp&"' and UnregulatedMain='"&NewsID&"'")
i= i + 1
next
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -