downinfomanage.asp
来自「ASP编写的一个公司网站的源程序」· ASP 代码 · 共 192 行
ASP
192 行
<%@ Language=VBScript %>
<!--#include virtual="/Include/Const.asp"-->
<!--#include virtual="/Include/DBConn.asp"-->
<!--#include virtual="/Include/ChkSession.asp"-->
<!--#include virtual="/Include/FuncPub.asp"-->
<!--#Include virtual="/include/PageNavigator.asp"-->
<html>
<head>
<title><%=Application("Site_Name")%></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content=" ">
<link rel="stylesheet" href="../Css/Css.css" type="text/css">
<script language="Javascript" src="/JS/CheckInput.js"></script>
<script language="javascript">
<!--
function deleted(DoType,url) {
var Content=DoType;
var truthBeTold =window.confirm("你确定要"+Content+"?");
if (truthBeTold) {
window.location = ( url )
}
else
{
return false;
}
}
-->
</script>
</head>
<body>
<!--#include file="Menu.asp"-->
<%
If Request("opr")<>"" then
If Request("opr")="set" then
If Request("state")<>"" and Request("ID")<>"" then
Conn.Execute "Update DownInfo Set state="&Request("state")&" where down_ID="&Request("ID")&""
End IF
ElseIF Request("opr")="del" then
if Request("ID")<>"" then
Conn.Execute "delete * from DownInfo where down_ID="&Request("ID")&""
End IF
End IF
End IF
'----查询条件Start----------------------------
Dim SearchItem
If UCASE(Trim(Request("WhereItem"))) = "TRUE" then '保留 Session("WhereString")的值
Else '不保留 Session("WhereString") 的值
Dim keyname,type_ID
keyname = ModifyInput(Request("keyname"))
type_ID = ModifyInput(trim(Request("type_ID")))
Session("WhereString") = " WHERE 1=1 "
If type_ID <> "" Then
Session("WhereString") = Session("WhereString") & " AND type_ID="& type_ID &" "
END If
If keyname <> "" Then
Session("WhereString") = Session("WhereString") & " AND down_Title like '%"& keyname &"%' or down_Content like '%"&keyname&"%' "
END If
End If
%>
<!--------Center Start ----------------->
<!--列出Users-->
<!--注意事项-->
<!-- 以下代码由程序自动生成 -->
<form method="POST" name="frmUsersList" action="DeleteNews.asp" ID="Form1">
<table border=0 cellspacing=1 cellpadding=2 class=list width=98% ID="Table1">
<tr class=header>
<td width=20 nowrap>ID</td>
<td width=150 >标题</td>
<td>类别</td>
<td>文件路径</td>
<td colspan=2>操作</td>
</tr>
<%
'Dim WOA
'Set WOA = Server.CreateObject("Com.Char")
Dim strSQL
strSQL = "SELECT * FROM DownInfo "
StrSQL = StrSQL & Session("WhereString")
strSQL = strSQL & " Order by type_ID,orderline asc" '加上排序条件
'Response.Write strsql ' 用于测试
'On Error Resume Next
'Response.End
'打开数据链接
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQL, Conn, adOpenKeyset ,adLockReadOnly
' 如果没有数据,则结束网页
If rs.EOF Then
Response.Write "<Font Color=Red>没有找到记录!</Font><br>"
Response.Write "<input type=""button"" name=""btnAdd"" value=""添加"" onclick=""window.location.href='DownInfoAdd.asp'"">"
Response.End
End If
' 否则初始化页
Call InitRS( rs, 10 ) ' 默认每页 20 行
Dim i
For i = 1 To PageSize
%>
<tr>
<td class=list><%= rs("down_ID") %></td>
<td class=list nowrap><% If(len(DeModifyInput(rs("down_title"))))>20 then Response.Write left(DeModifyInput(rs("down_title")),20)&".." else Response.Write DeModifyInput(rs("down_title"))%></td>
<td class=list nowrap>
<%Dim rstype,StrSQLtype
Set rstype = Server.CreateObject("Adodb.Recordset")
StrSQLType = "Select * From DownType where Type_ID="&rs("Type_ID")&""
rstype.Open StrSQLType,conn,1,3
If not rstype.EOF then
Response.Write left(rstype("Type_Name"),4)
End IF
rstype.Close
%></td>
<td class=list>
<%
Dim strFullPath
strFullPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
if Right(strFullPath,1) = "\" then
strFullPath = left(strFullPath,len(strFullPath)-1)
end if
strFullPath = strFullPath & UPLOAD_FILESPATH & rs("down_path")
strFullPath = Replace(strFullPath,"/","\")
Dim fso,f
set fso = Server.CreateObject("Scripting.FileSystemObject")
if fso.FileExists(strFullPath) = True then%>
<a href=<%=replace(UPLOAD_FILESPATH&rs("down_path"),"\","/")%>><%=UPLOAD_FILESPATH&rs("down_path")%></a>
<%else%>
<font color=gray><%=UPLOAD_FILESPATH&rs("down_path")%></font>
<%end if%>
</td>
<td class=list colspan=2 width=180 nowrap> <%
If rs("state") = 0 Then
Response.Write "<a href='DownInfoManage.asp?opr=set&state=1&ID="&rs("down_ID")&"&WhereItem=True' title='点击信息被开放' onclick='return deleted(""开放信息"",this.href);'><u>[开放]</u></a>"
Else
Response.Write "<a href='DownInfoManage.asp?opr=set&state=0&ID="&rs("down_ID")&"&WhereItem=True' title='点击信息被关闭' onclick='return deleted(""关闭信息"",this.href);'><font color=red><u>[关闭]</u></font></a>"
End If
%>
<a href="DownInfoEdit.asp?down_ID=<%= rs("down_ID")%>&type_ID=<%=rs("type_ID")%>"><u>[修改]</u></a>
<a href="DownInfoManage.asp?opr=del&ID=<%=rs("down_ID")%>&WhereItem=True" title='点击信息被删除' onclick="return deleted('删除信息',this.href);"><u>[删除]</u></a>
</td>
</tr>
<%
rs.MoveNext
If rs.EOF Then Exit For
Next
rs.Close
Set rs = Nothing
Set fso = nothing
'关闭数据链接
%>
</table>
<table width="98%" border="0" cellspacing="0" cellpadding="0" ID="Table2">
<tr>
<td width="50%">
<input type="button" name="btnAdd" value="添加" onclick="window.location.href='DownInfoAdd.asp'" ID="Button1">
</td>
<td width="50%" align=right>
<% Call ShowPageNavigator( Request.ServerVariables("SCRIPT_NAME") & "?WhereItem=True&OrderItem=" & Trim(Request.QueryString("OrderItem")) & "&SortItem=" & Trim(Request.QueryString("SortItem")) , 1 ) %>
</td>
</tr>
</table>
</form>
<!-- 代码结束 -->
<!------------------------->
<!--#include virtual="/Include/DBClose.asp"-->
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?