www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/adminhtry/admin_downlog.asp

    <!--#include file="setup.asp"-->
<!--#include file="check.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称:新云网站管理系统
' 当前版本:NewAsp Site Management System Version 3.0
' 文件名称:admin_downlog.asp
' 更新日期:2007-10-7
' 官方网站:新云网络(www.newasp.net) QQ:94022511
'=====================================================================
' Copyright 2003-2007 newasp.net - All Rights Reserved.
' newasp is a trademark of newasp.net
'=====================================================================
Dim Action,isdel
ChannelID = Newasp.ChkNumeric(Request("ChannelID"))
If ChannelID = 0 Then ChannelID = 2
isdel = Newasp.ChkNumeric(Request("isdel"))
%>
<table class="TableBorder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th>软件管理选项</th>
	</tr>
	<tr>
		<form action="admin_downlog.asp?ChannelID=<%=ChannelID%>" method="post" name="myform">
			<td class="TableRow1">搜索: <input name="keyword" type="text" size="45" value="<%=Request("keyword")%>" /> 条件: <select name="queryopt">
			<option value="1">软件名称</option>
			<option value="2" selected="selected">用户名称</option>
			</select> <input class="Button" type="submit" name="Submit" value="开始搜索" /></td>
		</form>
	</tr>
	<tr>
		<td class="TableRow2" colspan="2"><strong>操作选项:</strong> <a href="admin_downlog.asp?ChannelID=<%=ChannelID%>">管理首页</a> | 
		<a href="?ChannelID=<%=ChannelID%>&isdel=1">已删除软件</a> | 
		<a href="?action=delall&ChannelID=<%=ChannelID%>" onClick="return confirm('此操作将删除所有的用户下载记录,确定要删除吗?')"><font color="red">删除所有下载记录</font></a></td>
	</tr>
</table>
<br />
<%
If Not ChkAdmin("9999") Then
	Server.Transfer("showerr.asp")
	Response.End
End If
Action = LCase(Trim(Request("action")))
Select Case Trim(Action)
Case "del"
	Call Deldownlog
Case "delall"
	Call Delalldownlog
Case Else
	Call showmain
End Select
If FoundErr = True Then
	ReturnError(ErrMsg)
End If

Admin_footer
SaveLogInfo(AdminName)
CloseConn

Sub showmain()
	Dim CurrentPage,page_count,totalrec,Pcount,maxperpage
	Dim Rs,SQL,i,s,strListName,keyword,FoundSQL,s_ClassName
	Dim isdown,m_strstate,ChannelPath

	If Newasp.ChkNumeric(Newasp.BindDomain) = 0 Then
		ChannelPath = Trim(Newasp.InstallDir & Newasp.ChannelDir)
	Else
		ChannelPath = Trim(Newasp.DomainName) & "/"
	End If
	
	strListName = "&Channelid="& ChannelID &"&isdel="& isdel &"&keyword=" & Request("keyword") & "&queryopt=" & Request("queryopt")
	maxperpage = 30 '###每页显示数
	CurrentPage = Newasp.ChkNumeric(Request("page"))
	If CurrentPage = 0 Then CurrentPage = 1
	If Not IsNull(Request("keyword")) And Trim(Request("keyword")) <> "" Then
		keyword = Newasp.CheckStr(Trim(Request("keyword")))
		If Newasp.ChkNumeric(Request("queryopt")) = 1 Then
			FoundSQL = " And title like '%" & keyword & "%'"
		Else
			FoundSQL = " And UserName='" & keyword & "'"
		End If
		s_ClassName = "查询记录"
	Else
		FoundSQL = ""
	End If
	totalrec = Newasp.Execute("SELECT COUNT(softid) FROM [NC_UserDown] WHERE ChannelID=" & ChannelID & " And isdel=" & isdel & FoundSQL)(0)
	Pcount = CLng(totalrec / maxperpage)  '得到总页数
	If Pcount < totalrec / maxperpage Then Pcount = Pcount + 1
	If CurrentPage > Pcount Then CurrentPage = Pcount
	page_count = 0
	Set Rs = Server.CreateObject("ADODB.Recordset")
	SQL = "SELECT id,ChannelID,userid,UserName,softid,title,downhits,lasttime,isdown1,isdown2,isdel FROM [NC_UserDown] WHERE ChannelID=" & ChannelID & " And isdel=" & isdel & FoundSQL & " ORDER BY lasttime DESC ,id DESC"
	If IsSqlDataBase = 1 Then
		If CurrentPage > 100 Then
			Rs.Open SQL, Conn, 1, 1
		Else
			Set Rs = Newasp.Execute(SQL)
		End If
	Else
		Rs.Open SQL, Conn, 1, 1
	End If
%>
<script language="JavaScript" src="include/showpage.js"></script>
<table class="TableBorder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th nowrap="nowrap" width="5%">选择</th>
		<th width="55%">软件名称</th>
		<th nowrap="nowrap" width="15%">最后下载时间</th>
		<th nowrap="nowrap" width="12%">用户名称</th>
		<th nowrap="nowrap" width="8%">下载次数</th>
		<th nowrap="nowrap" width="5%">状态</th>
	</tr>
	<form action="" method="post" name="selform">
<%
	If Rs.EOF And Rs.BOF Then
%>
		<tr>
			<td class="TableRow2" align="center" colspan="6">还没有找到任何下载记录!</td>
		</tr>
<%
	Else
		If Pcount > 1 then Rs.Move (CurrentPage - 1) * maxperpage
		SQL = Rs.GetRows(maxperpage)
		For i=0 To Ubound(SQL,2)
			If (i Mod 2) = 0 Then
				s = 2
			Else
				s = 1
			End If
			isdown = Newasp.ChkNumeric(SQL(8,i) + SQL(9,i))
			If isdown > 0 Then
				m_strstate = "<b style=""color:blue;"" title=""已下载"">√</b>"
			Else
				m_strstate = "<b style=""color:red;"" title=""未下载"">×</b>"
			End If
%>
		<tr>
			<td class="TableRow<%=s%>" align="center"><input type="checkbox" name="sid" value="<%=SQL(0,i)%>"></td>
			<td class="TableRow<%=s%>"><a href="<%=ChannelPath%>softdown.asp?softid=<%=SQL(4,i)%>" target="_blank"><%=Server.HTMLEncode(SQL(5,i))%></a></td>
			<td class="TableRow<%=s%>" align="center" nowrap="nowrap"><%=FormatshowTime(SQL(7,i))%></td>
			<td class="TableRow<%=s%>" align="center" nowrap="nowrap"  title="查看该用户的详细信息"><a href="admin_user.asp?action=edit&userid=<%=SQL(2,i)%>"><%=SQL(3,i)%></a></td>
			<td class="TableRow<%=s%>" align="center"><%=SQL(6,i)%></td>
			<td class="TableRow<%=s%>" align="center"><%=m_strstate%></td>
		</tr>
<%
			page_count = page_count + 1
		Next
		SQL=Null
	End If
	Rs.Close:Set Rs = Nothing
%>
		<tr>
			<td class="TableRow1" colspan="7">
			<input type="hidden" name="ChannelID" value="<%=ChannelID%>" /><input type="hidden" name="action" value="del" />
			<input class="Button" type="button" onClick="CheckAll(this.form)" name="chkall" value="全选" /><input class="Button" type="button" onClick="ContraSel(this.form)" name="chksel" value="反选" /> 
			<input class="Button" type="submit" onclick="return confirm('删除后不能恢复,您确定执行该操作吗?');" name="Submit2" value="删除下载记录" /></td>
		</tr>
	</form>
	<tr>
		<td class="TableRow2" align="right" colspan="6"><%ShowListPage CurrentPage,Pcount,totalrec,maxperpage,strListName,s_ClassName %></td>
	</tr>
</table>
<%
End Sub

Sub Deldownlog()
	If Trim(Request("sid")) <> "" Then
		Newasp.Execute ("DELETE FROM [NC_UserDown] WHERE ChannelID="& ChannelID &" And id in (" & Request("sid") & ")")
	End If
	Response.redirect (Request.ServerVariables("HTTP_REFERER"))
End Sub

Sub Delalldownlog()
%>
<table class="TableBorder" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<th>删除所有下载记录</th>
	</tr>
	<form action="" method="post" name="form2">
	<tr>
		<td class="TableRow2"><b>说明:</b><br/><font color="blue">①、此操作将删除所有会员下载记录不能恢复,删除后可以节省数据库空间,不过会员将看不到他的下载记录。<br/>
		②、如果您确定要删除,请点击确定删除所有下载记录</font></td>
	</tr>
	<input type="hidden" name="ChannelID" value="<%=ChannelID%>" />
	<input type="hidden" name="action" value="delall" />
	<input type="hidden" name="del" value="yes" />
	<tr>
		<td class="TableRow1" align="center"><input class="Button" type="submit" onclick="return confirm('删除后不能恢复,您确定执行该操作吗?');" name="Submit2" value="确定删除所有下载记录" /></td>
	</tr>
	</form>
</table>
<%
	If Request("del") = "yes" Then
		Newasp.Execute ("DELETE FROM [NC_UserDown] WHERE ChannelID="& ChannelID)
		Response.redirect ("admin_downlog.asp?ChannelID="& ChannelID)
	End If
End Sub

%>