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

📄 admin_sourcemanage.asp

📁 个人网站比较简短
💻 ASP
📖 第 1 页 / 共 5 页
字号:
    If KeyID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的关键字ID</li>"
        Exit Sub
    End If
    sqlKey = "Select * from PE_NewKeys where ID=" & KeyID
    Set rsKey = Server.CreateObject("Adodb.RecordSet")
    rsKey.Open sqlKey, Conn, 1, 1
    If rsKey.BOF And rsKey.EOF Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>不存在此关键字!</li>"
    Else
        Response.Write "<form method='post' action='Admin_SourceManage.asp' name='myform'>"
        Response.Write "  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
        Response.Write "    <tr class='title'> "
        Response.Write "      <td height='22' colspan='2'> <div align='center'><font size='2'><strong>修 改 关 键 字</strong></font></div></td>"
        Response.Write "    </tr>"
        Response.Write "    <tr> "
        Response.Write "      <td width='100%' class='tdbg' align='center'><strong>关 键 字 :</strong><input name='KeyText' type='text' value='" & rsKey("KeyText") & "'> <font color='#FF0000'>*</font></td>"
        Response.Write "    </tr>"
        Response.Write "    <tr>"
        Response.Write "      <td width='100%' class='tdbg' align='center'><strong>所属频道:</strong><select name='ChannelID'>" & ChannelList & "<option value=0"
        If ChannelID = 0 Then Response.Write " selected"
        Response.Write ">全部频道</option></select>"
        Response.Write "      </td>"
        Response.Write "    </tr>"
        Response.Write "    <tr>"
        Response.Write "      <td colspan='2' align='center' class='tdbg'>"
        Response.Write "      <input name='TypeSelect' type='hidden' id='TypeSelect' value='SaveModifyKeyword'>"
        Response.Write "      <input name='ID' type='hidden' id='ID' value=" & rsKey("ID") & ">"
        Response.Write "      <input  type='submit' name='Submit' value='保存修改结果' style='cursor:hand;'>&nbsp;<input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick=""window.location.href='Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Keyword'"" style='cursor:hand;'></td>"
        Response.Write "    </tr>"
        Response.Write "  </table>"
        Response.Write "</form>"
    End If
    rsKey.Close
    Set rsKey = Nothing
End Sub


Sub SaveAddKeyword()
    Dim KeyText
    Dim rsKey, sqlKey
    
    KeyText = Trim(Request("KeyText"))
    If KeyText = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>关键字不能为空!</li>"
    Else
        KeyText = ReplaceBadChar(KeyText)
    End If
    If FoundErr = True Then
        Exit Sub
    End If
    sqlKey = "Select * from PE_NewKeys where ChannelID=" & ChannelID & " and KeyText='" & KeyText & "'"
    Set rsKey = Server.CreateObject("Adodb.RecordSet")
    rsKey.Open sqlKey, Conn, 1, 3
    If Not (rsKey.BOF And rsKey.EOF) Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>数据库中已经存在此关键字!</li>"
        rsKey.Close
        Set rsKey = Nothing
        Exit Sub
    End If
    rsKey.addnew
    rsKey("ChannelID") = ChannelID
    rsKey("KeyText") = KeyText
    rsKey("Hits") = 0
    rsKey("LastUseTime") = Now()
    rsKey.Update
    rsKey.Close
    Set rsKey = Nothing
    Call CloseConn
    Response.Redirect "Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Keyword"
End Sub

Sub SaveModifyKeyword()
    Dim KeyText, KeyID
    Dim rsKey, sqlKey
    KeyText = Trim(Request("KeyText"))
    If KeyText = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>关键字不能为空!</li>"
    End If
    KeyID = PE_CLng(Trim(Request("ID")))
    If KeyID = 0 Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要修改的关键字ID</li>"
        Exit Sub
    End If
    If FoundErr = True Then
        Exit Sub
    End If
    Set rsKey = Server.CreateObject("Adodb.RecordSet")
    sqlKey = "Select ChannelID,KeyText from PE_NewKeys where ID=" & KeyID
    rsKey.Open sqlKey, Conn, 1, 3
    If Not (rsKey.BOF And rsKey.EOF) Then
        If rsKey("ChannelID") = ChannelID And ChannelID > 0 Then
            Conn.Execute ("update PE_" & ModuleName & " set Keyword='|" & KeyText & "|' where ChannelID=" & ChannelID & " and Keyword = '|" & rsKey("KeyText") & "|'")
        End If
        rsKey("ChannelID") = ChannelID
        rsKey("KeyText") = KeyText
        rsKey.Update
    End If
    rsKey.Close
    Set rsKey = Nothing
    Call CloseConn
    Response.Redirect "Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Keyword"
End Sub

Sub DelKeyword()
    Dim KeyID
    KeyID = Trim(Request("ID"))
    If IsValidID(KeyID) = False Then
        KeyID = ""
    End If
    If KeyID = "" Then
        FoundErr = True
        ErrMsg = ErrMsg & "<li>请指定要删除的关键字ID</li>"
        Exit Sub
    End If
    If InStr(KeyID, ",") > 0 Then
        Conn.Execute ("delete from PE_NewKeys where ID in (" & KeyID & ")")
    Else
        Conn.Execute ("delete from PE_NewKeys where ID=" & KeyID & "")
    End If
    Call CloseConn
    Response.Redirect "Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Keyword"
End Sub

Sub DelAllKeyword()
    Conn.Execute ("delete from PE_NewKeys where ChannelID=" & ChannelID)
    Call CloseConn
    Response.Redirect "Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Keyword"
End Sub

'**************
'作者处理部分
'**************

Sub Author()
    Dim rsAuthor, sqlAuthor, rsChannelAuthor
    Dim iCount
    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'><tr class='title'><td height='22'> | "
    If ChannelID = 0 Then
        Response.Write "<font color='red'>全站作者</font>"
    Else
        Response.Write "<a href='Admin_SourceManage.asp?ChannelID=0&TypeSelect=Author&ItemType=" & ItemType & "'>全站作者</a>"
    End If
    Set rsChannelAuthor = Conn.Execute("select ChannelID,ChannelName from PE_Channel Where ModuleType in (1,2,3) and Disabled=" & PE_False & " order by OrderID")
    Do While Not rsChannelAuthor.EOF
        If rsChannelAuthor("ChannelID") = ChannelID Then
            Response.Write " | <font color='red'>" & rsChannelAuthor("ChannelName") & "</font>"
        Else
            Response.Write " | <a href='Admin_SourceManage.asp?ChannelID=" & rsChannelAuthor("ChannelID") & "&TypeSelect=Author&ItemType=" & ItemType & "'>" & rsChannelAuthor("ChannelName") & "</a>"
        End If
        rsChannelAuthor.MoveNext
    Loop
    Set rsChannelAuthor = Nothing
    Response.Write " |</td></tr></table>"

    Response.Write "<br><table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'><tr class='title'><td height='22'> | <a href='Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Author&ItemType=1'>"
    If ItemType = 1 Then
        Response.Write "<font color=red>" & XmlText("ShowSource", "ShowAuthor/AuthorType1", "大陆作者") & "</font>"
    Else
        Response.Write XmlText("ShowSource", "ShowAuthor/AuthorType1", "大陆作者")
    End If
    Response.Write "</a> | <a href='Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Author&ItemType=2'>"
    If ItemType = 2 Then
        Response.Write "<font color=red>" & XmlText("ShowSource", "ShowAuthor/AuthorType2", "港台作者") & "</font>"
    Else
        Response.Write XmlText("ShowSource", "ShowAuthor/AuthorType2", "港台作者")
    End If
    Response.Write "</a> | <a href='Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Author&ItemType=3'>"
    If ItemType = 3 Then
        Response.Write "<font color=red>" & XmlText("ShowSource", "ShowAuthor/AuthorType3", "海外作者") & "</font>"
    Else
        Response.Write XmlText("ShowSource", "ShowAuthor/AuthorType3", "海外作者")
    End If
    Response.Write "</a> | <a href='Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Author&ItemType=4'>"
    If ItemType = 4 Then
        Response.Write "<font color=red>" & XmlText("ShowSource", "ShowAuthor/AuthorType4", "本站特约") & "</font>"
    Else
        Response.Write XmlText("ShowSource", "ShowAuthor/AuthorType4", "本站特约")
    End If
    Response.Write "</a> | <a href='Admin_SourceManage.asp?ChannelID=" & ChannelID & "&TypeSelect=Author&ItemType=0'>"
    If ItemType = 0 Then
        Response.Write "<font color=red>" & XmlText("ShowSource", "ShowAuthor/AuthorType5", "其他作者") & "</font>"
    Else
        Response.Write XmlText("ShowSource", "ShowAuthor/AuthorType5", "其他作者")
    End If

    Response.Write "</a> |</td></tr></table><br>"
    Response.Write "  <form name='myform' method='Post' action='Admin_SourceManage.asp' onsubmit=""return confirm('确定要删除选中的作者吗?');"">"
    Response.Write "<table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>"
    Response.Write "  <tr align='center' class='title' height='22'>"
    Response.Write "    <td width='30'><strong>选中</strong></td>"
    Response.Write "    <td width='40'><strong>序号</strong></td>"
    Response.Write "    <td width='80'><strong>姓名</strong></td>"
    Response.Write "    <td width='40' height='22'><strong>性别</strong></td>"
    Response.Write "    <td height='22'><strong>简介</strong></td>"
    Response.Write "    <td width='80' height='22'><strong>作者分类</strong></td>"
    Response.Write "    <td width='60' height='22'><strong>状态</strong></td>"
    Response.Write "    <td width='150' height='22'><strong>操 作</strong></td>"
    Response.Write "  </tr>"
 
    '检查作者模板字段是否存在
    Dim dbrr, i
    dbrr = False
    Set rsAuthor = Conn.Execute("select top 1 * from PE_Author")
    For i = 0 To rsAuthor.Fields.Count - 1
        If rsAuthor.Fields(i).name = "TemplateID" Then
            dbrr = True
        End If
    Next
    rsAuthor.Close
    Set rsAuthor = Nothing
    If dbrr <> True Then
        If SystemDatabaseType = "SQL" Then
            Conn.Execute ("alter table [PE_Author] add TemplateID int DEFAULT (0)")
        Else
            Conn.Execute ("alter table [PE_Author] add COLUMN TemplateID int 0")
        End If
    End If

    Set rsAuthor = Server.CreateObject("Adodb.RecordSet")
    sqlAuthor = "select * from PE_Author Where ChannelID=" & ChannelID
    If Keyword <> "" Then
        Select Case strField
        Case "name"
            sqlAuthor = sqlAuthor & " and AuthorName like '%" & Keyword & "%' "
        Case "address"
            sqlAuthor = sqlAuthor & " and Address like '%" & Keyword & "%' "
        Case "Phone"
            sqlAuthor = sqlAuthor & " and Tel like '%" & Keyword & "%' "
        Case "intro"
            sqlAuthor = sqlAuthor & " and Intro like '%" & Keyword & "%' "
        Case Else
            sqlAuthor = sqlAuthor & " and AuthorName like '%" & Keyword & "%' "
        End Select
    End If
    If ItemType < 999 Then
        sqlAuthor = sqlAuthor & " and AuthorType =" & ItemType
    End If
    sqlAuthor = sqlAuthor & " order by ID Desc"
    rsAuthor.Open sqlAuthor, Conn, 1, 1
    If rsAuthor.BOF And rsAuthor.EOF Then
        rsAuthor.Close
        Set rsAuthor = Nothing
        Response.Write "  <tr class='tdbg'><td colspan='10' align='center'><br>没有任何作者!<br><br></td></tr></table>"
        Exit Sub
    End If
    
    totalPut = rsAuthor.RecordCount
    If CurrentPage < 1 Then

⌨️ 快捷键说明

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