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

📄 resource_process.asp

📁 一个很好的asp cms管理系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
Option Explicit
'----------------------------------------------------------------------------------
'本页:
'   资源处理页面
'说明:
'
'----------------------------------------------------------------------------------
%>
<!--#include file="inc/Config.class.asp"-->
<!--#include file="inc/DBControl.class.asp"-->
<!--#include file="inc/FunctionLib.class.asp"-->
<!--#include file="inc/Manager.class.asp"-->
<!--#include file="inc/md5.asp"-->
<%
Dim Cfg, Db, FLib, Admin
Set Cfg = New Config
Set Db = New DBControl
Set FLib = New FunctionLib
Set Admin = New Manager

If Not Admin.Logined Then
    FLib.Alert "对不起,你已经超时或未登录","./",1
    Response.End
End If

Db.Open()

Dim Work
    Work = Request("Work")

'选择执行操作'
Select Case Work
    Case "MdyReco"
        MdyReco()
    Case "AddReco"
        AddReco()
    Case "DeleteReco"
        DeleteReco()
    Case "CheckReco"
        CheckReco()
    Case "CallBackReco"
        CallBackReco()
End Select

Function AddReco()
    Dim class_id, title, short_content, go_url, content, keyword, special, author, resfrom, total_hit, pages_head, pages_position, small_img
    Dim file_path
	Dim shareidstr,sharerale,shareid
    class_id            = FLib.SafeSql(Request("class_id"))
    title               = FLib.SafeSql(Request("title"))
    short_content       = FLib.SafeSql(Request("short_content"))
    go_url              = FLib.SafeSql(Request("go_url"))
    content             = FLib.SafeSql(Request("NewsContent"))
    keyword             = FLib.SafeSql(Request("keyword"))
    special             = FLib.SafeSql(Request("special"))
    author              = FLib.SafeSql(Request("author"))
    resfrom             = FLib.SafeSql(Request("resfrom"))
    total_hit           = FLib.SafeSql(Request("total_hit"))
    pages_head          = FLib.SafeSql(Request("pages_head"))
    pages_position      = FLib.SafeSql(Request("pages_position"))
    small_img           = FLib.SafeSql(Request("small_img") )
	shareidstr          = Flib.SafeSql(Request("shareidstr"))
	sharerale           = Flib.SafeSql(Request("sharerale"))
    If title = "" Or Not IsNumeric(class_id) Or keyword = "" Or Not IsNumeric(total_hit) Or Not IsNumeric(pages_head) Or Not IsNumeric(pages_position) Then
        FLib.Alert "参数有误", "BACK", 0
        Response.End
    End If

    If go_url <> "" Then
        file_path = go_url
    Else
        file_path = ""
    End If

    If Not FLib.chkPope_AboutTheClass(class_id, "append") Then
        FLib.Alert "你无法在此频道进行添加操作", "BACK", 0
        Response.End
    End If

    Dim RecordId,RecordId_temp
        RecordId = FLib.CreateRecordId("resource_list_id")
		RecordId_temp = RecordId
    Dim Rs, Sql
    Set Rs = Db.CreateRs()

    Sql = Db.SqlTran("SELECT * FROM resource_list WHERE 1=2")
    Rs.Open Sql, Db.Conn, 1, 3
    Rs.AddNew()
    Rs("id")                = RecordId
    Rs("class_id")          = class_id
    Rs("title")             = title
    Rs("short_content")     = short_content
    Rs("go_url")            = go_url
    Rs("keyword")           = keyword
    Rs("special")           = special
    Rs("author")            = ""
    Rs("resfrom")           = resfrom
    Rs("relate_list")       = GetResourceRelateList(keyword, Cfg.Resource_RelateList_Max)
    Rs("creator")           = Admin.UserName
    Rs("file_path")         = file_path
    Rs("visit_url")         = ""
    Rs("small_img")         = small_img
    Rs("checked")           = 0
    Rs("deleted")           = 0
    Rs("created")           = 0
    Rs("pages_head")        = pages_head
    Rs("pages_position")    = pages_position
    Rs("pages_count")       = 0
    Rs("addtime")           = Now()
	Rs("shareidstr")        = shareidstr
	Rs("shareid")           = 0
	Rs("sharerale")         = 0
    Rs.Update()
    Rs.Close

    Sql = Db.SqlTran("SELECT * FROM resource_data WHERE 1=2")
    Rs.Open Sql, Db.Conn, 1, 3
    Rs.AddNew()
    Rs("res_id")            = RecordId
    Rs("content")           = content
    Rs("content_size")      = Len(content)
    Rs.Update()
    Rs.Close

    Sql = Db.SqlTran("SELECT * FROM resource_count WHERE 1=2")
    Rs.Open Sql, Db.Conn, 1, 3
    Rs.AddNew()
    Rs("res_id")            = RecordId
    Rs("total_hit")         = total_hit
    Rs.Update()
    Rs.Close()
	dim sharei
	shareid = split(shareidstr,",")
	For sharei = 0 to Ubound(shareid)
		if shareid(sharei)<>class_id Then
	        RecordId = FLib.CreateRecordId("resource_list_id")
		    Sql = Db.SqlTran("SELECT * FROM resource_list WHERE 1=2")
    		Rs.Open Sql, Db.Conn, 1, 3
	    	Rs.AddNew()
	    	Rs("id")                = RecordId
		    Rs("class_id")          = shareid(sharei)
    		Rs("title")             = title
		    Rs("short_content")     = short_content
    		Rs("go_url")            = go_url
	    	Rs("keyword")           = keyword
		    Rs("special")           = special
		    Rs("author")            = ""
	    	Rs("resfrom")           = resfrom
		    Rs("relate_list")       = GetResourceRelateList(keyword, Cfg.Resource_RelateList_Max)
		    Rs("creator")           = Admin.UserName
	    	Rs("file_path")         = file_path
		    Rs("visit_url")         = ""
		    Rs("small_img")         = small_img
	    	Rs("checked")           = 0
		    Rs("deleted")           = 0
		    Rs("created")           = 0
    		Rs("pages_head")        = pages_head
		    Rs("pages_position")    = pages_position
		    Rs("pages_count")       = 0
	    	Rs("addtime")           = Now()
			Rs("shareidstr")        = ""
			Rs("shareid")           = RecordId_temp
			Rs("sharerale")         = 0
		    Rs.Update()
		    Rs.Close

	    	Sql = Db.SqlTran("SELECT * FROM resource_data WHERE 1=2")
	    	Rs.Open Sql, Db.Conn, 1, 3
		    Rs.AddNew()
    		Rs("res_id")            = RecordId
		    Rs("content")           = content
    		Rs("content_size")      = Len(content)
	    	Rs.Update()
		    Rs.Close

    		Sql = Db.SqlTran("SELECT * FROM resource_count WHERE 1=2")
	    	Rs.Open Sql, Db.Conn, 1, 3
	    	Rs.AddNew()
		    Rs("res_id")            = RecordId
    		Rs("total_hit")         = total_hit
		    Rs.Update()
		    Rs.Close()
		end if
	Next
    Set Rs = Nothing

    UpdatePageList RecordId, pages_head, pages_position

    FLib.Alert "添加完毕", "BACK", 0
    Response.End

End Function

Function MdyReco()
    Dim id, class_id, title, short_content, go_url, content, keyword, special, author, resfrom, total_hit, pages_head, pages_position, pages_count, small_img
    Dim file_path
	Dim shareidstr,sharerale,shareid,shareidstr_old,shareidstr_cmp
    id                  = FLib.SafeSql(Request("res_id"))
    class_id            = FLib.SafeSql(Request("class_id"))
    title               = FLib.SafeSql(Request("title"))
    short_content       = FLib.SafeSql(Request("short_content"))
    go_url              = FLib.SafeSql(Request("go_url"))
    content             = FLib.SafeSql(Request("NewsContent"))
    keyword             = FLib.SafeSql(Request("keyword"))
    special             = FLib.SafeSql(Request("special"))
    author              = FLib.SafeSql(Request("author"))
    resfrom             = FLib.SafeSql(Request("resfrom"))
    total_hit           = FLib.SafeSql(Request("total_hit"))
    pages_head          = FLib.SafeSql(Request("pages_head"))
    pages_position      = FLib.SafeSql(Request("pages_position"))
    pages_count         = FLib.SafeSql(Request("pages_count"))
    small_img           = FLib.SafeSql(Request("small_img"))
	shareidstr          = Flib.SafeSql(Request("shareidstr"))
	sharerale           = Flib.SafeSql(Request("sharerale"))
	if sharerale="" then sharerale=0

    If Not IsNumeric(id) Or title = "" Or Not IsNumeric(class_id) Or keyword = "" Or Not IsNumeric(total_hit) Or Not IsNumeric(pages_head) Or Not IsNumeric(pages_position) Or Not IsNumeric(pages_count) Then
        FLib.Alert "参数有误", "BACK", 0
        Response.End
    End If

    If go_url <> "" Then
        file_path = go_url
    Else
        file_path = ""
    End If

    Dim Rs, Sql
    Set Rs = Db.CreateRs()

    Sql = Db.SqlTran("SELECT * FROM resource_list WHERE id=" & id)
    Rs.Open Sql, Db.Conn, 1, 3

    If Not FLib.chkPope_AboutTheClass(Rs("class_id"), "modify") Then
        FLib.Alert "你无法在此频道进行修改操作", "BACK", 0
        Response.End
    End If
    shareidstr_old          = Rs("shareidstr")
	Rs("class_id")          = class_id
    Rs("title")             = title
    Rs("short_content")     = short_content
    Rs("go_url")            = go_url
    Rs("keyword")           = keyword
    'Rs("special")           = special
    Rs("author")            = author
    Rs("resfrom")           = resfrom
    Rs("relate_list")       = GetResourceRelateList(keyword, Cfg.Resource_RelateList_Max)
    'Rs("creator")           = Admin.UserName
    Rs("file_path")         = file_path
    Rs("visit_url")         = ""
    Rs("small_img")         = small_img
    Rs("checked")           = 0
    Rs("created")           = 0
    Rs("pages_head")        = pages_head
    Rs("pages_position")    = pages_position
    Rs("pages_count")       = pages_count
    Rs("uptime")            = Now()
	Rs("shareidstr")        = shareidstr
'	Rs("shareid")           = 0
	Rs("sharerale")         = sharerale
    Rs.Update()
    Rs.Close()

    Sql = Db.SqlTran("SELECT * FROM resource_data WHERE res_id=" & id)
    Rs.Open Sql, Db.Conn, 1, 3
    Rs("content")           = content
    Rs("content_size")      = Len(content)
    Rs.Update()
    Rs.Close()

    Sql = Db.SqlTran("SELECT * FROM resource_count WHERE res_id=" & id)
    Rs.Open Sql, Db.Conn, 1, 3
    Rs("total_hit")         = total_hit
    Rs.Update()
    Rs.Close()
	
	if len(shareidstr) > 0 then
	shareidstr_cmp = FLib.shareclassidstr(shareidstr,shareidstr_old)
	dim shareclassid_add,shareclassid_del,shareclassid_mod,ai,di,mi
	dim sharerecordid_del
	dim sharerecordid_modstr,sharerecordid_mod
	shareclassid_add = split(shareidstr_cmp(1),",")
	shareclassid_del = shareidstr_cmp(2)
	shareclassid_mod = shareidstr_cmp(0)
	response.write "新增频道列表"&ubound(shareclassid_add)&" "&shareidstr_cmp(1)&"<br>删除频道列表"&shareidstr_cmp(2)&"<br>修改频道列表"&shareidstr_cmp(0)
	Dim RecordId
	for ai = 0 to ubound(shareclassid_add)
		if shareclassid_add(ai)<>class_id Then
	        RecordId = FLib.CreateRecordId("resource_list_id")
		    Sql = Db.SqlTran("SELECT * FROM resource_list WHERE 1=2")
    		Rs.Open Sql, Db.Conn, 1, 3
	    	Rs.AddNew()
	    	Rs("id")                = RecordId
		    Rs("class_id")          = shareclassid_add(ai)
    		Rs("title")             = title
		    Rs("short_content")     = short_content
    		Rs("go_url")            = go_url
	    	Rs("keyword")           = keyword
		    Rs("special")           = special
		    Rs("author")            = ""
	    	Rs("resfrom")           = resfrom
		    Rs("relate_list")       = GetResourceRelateList(keyword, Cfg.Resource_RelateList_Max)
		    Rs("creator")           = Admin.UserName
	    	Rs("file_path")         = file_path
		    Rs("visit_url")         = ""
		    Rs("small_img")         = small_img
	    	Rs("checked")           = 0
		    Rs("deleted")           = 0

⌨️ 快捷键说明

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