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

📄 admin_database.asp

📁 个人网站比较简短
💻 ASP
📖 第 1 页 / 共 4 页
字号:
        ErrMsg = ErrMsg & "<li>请指定备份文件名</li>"
    End If
    If FoundErr = True Then Exit Sub
    bkfolder = Server.MapPath(bkfolder)
    If fso.FileExists(dbpath) Then
        If fso.FolderExists(bkfolder) = False Then
            fso.CreateFolder (bkfolder)
        End If
        fso.copyfile dbpath, bkfolder & "\" & bkdbname & ".asa"
        Call WriteSuccessMsg("备份数据库成功,备份的数据库为:<br>" & bkfolder & "\" & bkdbname & ".asa", ComeUrl)
        Call WriteEntry(1, AdminName, "备份数据库")
    Else
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到源数据库文件,请检查Conn.asp中的配置。</li>"
    End If
End Sub

Sub CompactData()
    'On Error Resume Next

    Dim Engine, strDBPath
    Call CloseConn

    strDBPath = Left(dbpath, InStrRev(dbpath, "\"))
    If fso.FileExists(dbpath) Then
        Set Engine = Server.CreateObject("JRO.JetEngine")
        Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath, " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb"
        fso.copyfile strDBPath & "temp.mdb", dbpath
        fso.DeleteFile (strDBPath & "temp.mdb")
        Set Engine = Nothing
        Call WriteSuccessMsg("数据库压缩成功!", ComeUrl)
        Call OpenConn
        Call WriteEntry(1, AdminName, "压缩数据库")
    Else
        FoundErr = True
        ErrMsg = ErrMsg & "<li>数据库没有找到!</li>"
    End If
    If Err.Number <> 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & Err.Description
        Err.Clear
        Exit Sub
    End If
End Sub

Sub RestoreData()
    Dim backpath
    backpath = Trim(Request.Form("backpath"))
    If backpath = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定原备份的数据库文件名!</li>"
        Exit Sub
    End If
    If GetFileExt(backpath) <> "asa" And GetFileExt(backpath) <> "asp" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>原备份数据库文件的扩展名必须为asa或asp!</li>"
        Exit Sub
    End If
    backpath = Server.MapPath(backpath)
    If fso.FileExists(backpath) Then
        fso.copyfile backpath, dbpath
        Call WriteSuccessMsg("成功恢复数据!", ComeUrl)
        Call WriteEntry(1, AdminName, "恢复数据库")
        Call ClearSiteCache(0)
    Else
        FoundErr = True
        ErrMsg = ErrMsg & "<li>找不到指定的备份文件!</li>"
    End If
End Sub

Sub ClearData()
    Dim strClear, z
    z = 0

    strClear = strClear & "<b>清空内容列表:</b>"
    strClear = strClear & "<br><br><b>频道数据:</b>"
    Dim ChannelTable, rsChannel, sqlChannel
    sqlChannel = "select * from PE_Channel where ChannelType<=1 and ChannelID<>4 order by OrderID"
    Set rsChannel = Conn.Execute(sqlChannel)
    Do While Not rsChannel.EOF
        If Request("C_PE_Class_" & rsChannel("ChannelID")) = "yes" Then
            Conn.Execute ("delete from PE_Class where ChannelID=" & rsChannel("ChannelID"))
            strClear = strClear & rsChannel("ChannelName") & "栏目&nbsp;&nbsp;"
            z = z + 1
        End If
        If Request("C_PE_Special_" & rsChannel("ChannelID")) = "yes" Then
            Conn.Execute ("delete from PE_Special where ChannelID=" & rsChannel("ChannelID"))
            strClear = strClear & rsChannel("ChannelName") & "专题&nbsp;&nbsp;"
            z = z + 1
        End If
        Select Case rsChannel("ModuleType")
        Case 1
            ChannelTable = "PE_Article"
        Case 2
            ChannelTable = "PE_Soft"
        Case 3
            ChannelTable = "PE_Photo"
        Case 5
            ChannelTable = "PE_Product"
        End Select
        If Request("C_" & ChannelTable & "_" & rsChannel("ChannelID")) = "yes" Then
            If ChannelTable = "PE_Product" Then
                Conn.Execute ("delete from PE_Product")
            Else
                Conn.Execute ("delete from " & ChannelTable & " where ChannelID=" & rsChannel("ChannelID"))
            End If
            strClear = strClear & rsChannel("ChannelName") & "数据&nbsp;&nbsp;"
            z = z + 1
        End If
        If Request("C_PE_Comment_" & rsChannel("ChannelID")) = "yes" Then
            
            '删除所属频道评论
            Dim Infotable
            If rsChannel("ModuleType") = 1 Then
                Infotable = "Article"
            ElseIf rsChannel("ModuleType") = 2 Then
                Infotable = "Photo"
            ElseIf rsChannel("ModuleType") = 3 Then
                Infotable = "Soft"
            ElseIf rsChannel("ModuleType") = 5 Then
                Infotable = "Product"
            End If
            
            Dim rsComment
            Set rsComment = Conn.Execute("Select I." & Infotable & "ID,I.ChannelID,C.InfoID from PE_" & Infotable & " I inner join PE_Comment C on I." & Infotable & "ID=C.InfoID where  I.ChannelID=" & rsChannel("ChannelID") & "")
            If rsComment.BOF And rsComment.EOF Then
            Else
                Do While Not rsComment.EOF
                    Conn.Execute "delete from PE_Comment where InfoID=" & rsComment("InfoID")
                    rsComment.MoveNext
                    z = z + 1
                Loop
            End If
            Set rsComment = Nothing
            'Conn.Execute ("delete from PE_Comment")
            strClear = strClear & rsChannel("ChannelName") & "评论&nbsp;&nbsp;"
        End If
        If Request("C_PE_JsFile_" & rsChannel("ChannelID")) = "yes" Then
            Conn.Execute ("delete from PE_JsFile where ChannelID=" & rsChannel("ChannelID"))
            strClear = strClear & rsChannel("ChannelName") & "JS数据&nbsp;&nbsp;"
            z = z + 1
        End If
        rsChannel.MoveNext
    Loop
    rsChannel.Close
    Set rsChannel = Nothing

    strClear = strClear & "<br><br><b>商城数据:</b>"
    If Request("S_PE_OrderForm") = "yes" Then
        Conn.Execute ("delete from PE_OrderForm")
        Conn.Execute ("delete from PE_OrderFormItem")
        Conn.Execute ("delete from PE_TransferItem")
        strClear = strClear & "订单数据&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_Bank") = "yes" Then
        Conn.Execute ("delete from PE_Bank")
        strClear = strClear & "银行帐户&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_BankrollItem") = "yes" Then
        Conn.Execute ("delete from PE_BankrollItem")
        Conn.Execute ("delete from PE_InvoiceItem")
        strClear = strClear & "资金记录&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_DeliverItem") = "yes" Then
        Conn.Execute ("delete from PE_DeliverItem")
        strClear = strClear & "发退货记录&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_DeliverType") = "yes" Then
        Conn.Execute ("delete from PE_DeliverType")
        Conn.Execute ("delete from PE_DeliverCharge")
        strClear = strClear & "送货方式&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_Payment") = "yes" Then
        Conn.Execute ("delete from PE_Payment")
        strClear = strClear & "在线支付记录&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_PaymentType") = "yes" Then
        Conn.Execute ("delete from PE_PaymentType")
        strClear = strClear & "付款方式&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_PresentProject") = "yes" Then
        Conn.Execute ("delete from PE_PresentProject")
        strClear = strClear & "促销方案&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_Producer") = "yes" Then
        Conn.Execute ("delete from PE_Producer")
        strClear = strClear & "生 产 商&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("S_PE_Trademark") = "yes" Then
        Conn.Execute ("delete from PE_Trademark")
        strClear = strClear & "商品品牌&nbsp;&nbsp;"
        z = z + 1
    End If

    strClear = strClear & "<br><br><b>其他数据:</b>"
    If Request("PE_Announce") = "yes" Then
        Conn.Execute ("delete from PE_Announce")
        strClear = strClear & "网站公告&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("PE_Advertisement") = "yes" Then
        Conn.Execute ("delete from PE_AdZone")
        Conn.Execute ("delete from PE_Advertisement")
        strClear = strClear & "网站广告&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("PE_Vote") = "yes" Then
        Conn.Execute ("delete from PE_Vote")
        strClear = strClear & "网站调查&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("PE_FriendSite") = "yes" Then
        Conn.Execute ("delete from PE_FsKind")
        Conn.Execute ("delete from PE_FriendSite")
        strClear = strClear & "友情链接&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("PE_Log") = "yes" Then
        Conn.Execute ("delete from PE_Log")
        strClear = strClear & "网站日志&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("PE_GuestBook") = "yes" Then
        Conn.Execute ("delete from PE_GuestBook")
        Conn.Execute ("delete from PE_GuestKind")
        strClear = strClear & "所有留言&nbsp;&nbsp;"
        z = z + 1
    End If
    If Request("PE_Author") = "yes" Then

⌨️ 快捷键说明

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