www.gusucode.com > QQ空间互踩整站源码asp网站源码程序 > QQ空间互踩整站源码asp网站源码程序/admin_manage.asp

    <!--#include file="conn.asp"-->
<%
dim action
action=request.QueryString("action")
if session("cutelink_admin")<>"OK" then
response.redirect "admin_login.asp"
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="style.css" rel="stylesheet" type="text/css">
<title>管理Qzone信息_<%=WebName&ChannelName%></title>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<!--#include file="top.asp"-->

<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" class="main_title1">
  <tr> 
    <td align="center"><a href="admin_manage.asp">管理首页</a> | <a href="?action=ListSite">列出所有Qzone</a> | <a href="?action=ShowLog"><font color="#0000FF">查看点击记录</font></a> |  
      <a href="admin_class.asp">修改Qzone信息</a> | <a href="?action=BatchDelform">批量删除数据</a> | <a href="admin_login.asp?action=exit">退出管理</a></td>
  </tr>
</table>
<br>
<table width="760" border="0" align="center" cellpadding="3" cellspacing="0" class="main_tdbg">
  <tr> 
    <td height="30">您的位置:<a href="<%=WebUrl%>">首页</a> 
      -> <a href="admin_manage.asp">管理首页</a> -> 管理网站信息</td>
  </tr>
</table>
<br>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" class="main_tdbg">
  <tr> 
    <td> <%
select case action
case "del"
	call dellink
case "delall"
	call delalllink	
case "init"
	call init
case "BatchDelform"
	call BatchDelform
case "BatchDelWeb"
	call BatchDelWeb
case "BatchDelLog"
	call BatchDelLog
case "ShowLog"
	call ShowLog
case "ListSite"
	call ListSite
case "CompactDB"
	call Compact
case "ClearCache"
	call ClearCache
case else
	call main
end select
sub main
%>
      <table width="740" border="0" align="center" cellpadding="3" cellspacing="0">
        <tr valign="top"> 
          <td width="110"><img src="images/common.gif" width="9" height="15"> 
            <a href="?action=ListSite"><font color="#0000FF">列出所有网站</font></a></td>
          <td>10种排序方式显示各个Qzone的信息,您可以修改、初始化、删除其Qzone并查看点入点出记录。</td>
        </tr>
        <tr valign="top"> 
          <td><img src="images/common.gif" width="9" height="15"> <a href="?action=ShowLog"><font color="#0000FF">查看点击记录</font></a></td>
          <td>查看所有用户的点入点出记录,也可单独查看点入或点出的记录,也可单独查看某一用户的点入点出记录。</td>
        </tr>
        <tr valign="top"> 
          <td><img src="images/common.gif" width="9" height="15"> <a href="?action=BatchDelform"><font color="#0000FF">批量删除数据</font></a></td>
          <td>可选择删除初始化后指定天数内总点击进入数小于指定数量的站点; 删除指定天数前的点击记录(用户3天内的点入点出记录不会被删除)。 
          </td>
        </tr>
        <tr valign="top"> 
          <td><img src="images/common.gif" width="9" height="15"> <a href="?action=init" onClick="return confirm('初始化后,所有数据将清零,你确认要继续吗?')"><font color="#0000FF">初始化所有数据</font></a></td>
          <td>初始化后,所有网站的数据都将清零,请谨慎操作!</td>
        </tr>
        <tr valign="top"> 
          <td><img src="images/common.gif" width="9" height="15"> <a href="?action=ClearCache" onClick="return confirm('此功能将删除本系统上的缓存,你确认要继续吗?')"><font color="#0000FF">删除本系统缓存</font></a></td>
          <td>执行后,link.asp和js.asp将立刻显示最新的数据。</td>
        </tr>
        <tr valign="top"> 
          <td><img src="images/common.gif" width="9" height="15"> <a href="?action=CompactDB" onClick="return confirm('你确定要压缩吗?')"><font color="#0000FF">压缩数据库</font></a></td>
          <td>建议每隔一段时间,对数据库进行压缩操作。如果您的服务器不支持FSO,请将数据库下载到本地,用Access2000压缩数据库。</td>
        </tr>
        <tr valign="top"> 
          <td><img src="images/common.gif" width="9" height="15"> <a href="admin_login.asp?action=exit"><font color="#0000FF">退出管理</font></a></td>
          <td>防止他人非法更改资料哦!管理完毕,请一定要退出,尤其是在公用的电脑上。</td>
        </tr>
      </table> 
      <%
end sub
sub ListSite
dim find,webtype,pl
dim rs,sql
dim condition,linkstr
find=hx.checkstr(request("find"),20)
webtype=request("webtype")

sql="select * from CL_Link"
condition = " where 1=1 " 

pl=request("pl")
if pl="" then
pl="inp"
end if
linkstr = "pl=" & pl

if webtype="" or not isnumeric(webtype) then
webtype=0 
elseif webtype>0 then
condition = condition & " and webtype="&webtype
end if
linkstr = linkstr & "&action=ListSite&webtype="&webtype


if find<>"" then
condition = condition & " and (sitename like '%"&find&"%' or siteintro like '%"&find&"%' or siteurl like '%"&find&"%')"
linkstr = linkstr & "&action=ListSite&find="&find
end if

'分页信息
dim PageNo
PageNo=Request.QueryString("PageNo")
if PageNo="" or not isnumeric(PageNo) then
PageNo=1
else
PageNo=int(PageNo)
end if

'普通sql语句
sql=sql & condition &" ORDER BY "&pl&" DESC"

%> 
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <form method="post" action="?action=ListSite">
          <tr> 
            <td height="30" align="center" valign="middle"> <p>关键字: 
                <input name="find" type="text" id="find" value="<%=find%>" size="15" maxlength="20">
                网站分类: 
                <select name="webtype" size="1">
                  <option value="">全部类别</option>
                  <%hx.listwebtype(webtype)%>
                </select>
                排序: 
                <select name="pl" size="1">
                  <option value="inc"<%if pl="inc" then%> selected<%end if%>>总计点入</option>
                  <option value="inj"<%if pl="inj" then%> selected<%end if%>>今天点入</option>
                  <option value="inp"<%if pl="inp" then%> selected<%end if%>>平均点入</option>
                  <option value="outc"<%if pl="outc" then%> selected<%end if%>>总计点出</option>
                  <option value="outj"<%if pl="outj" then%> selected<%end if%>>今天点出</option>
                  <option value="outp"<%if pl="outp" then%> selected<%end if%>>平均点出</option>
                  <option value="indate"<%if pl="indate" then%> selected<%end if%>>点入时间</option>
                  <option value="outdate"<%if pl="outdate" then%> selected<%end if%>>点出时间</option>
                  <option value="fromdate"<%if pl="fromdate" then%> selected<%end if%>>统计时间</option>
                  <option value="dateandtime"<%if pl="dateandtime" then%> selected<%end if%>>加入时间</option>
                </select>
                <input name="submit" type="submit" value="查 询">
                &nbsp; 
            </td>
          </tr></form>
          <tr> 
            <td height="30" align="center"><%hx.showPageInfo "CL_link","username",condition,PageNo,MaxPageSize,linkstr%>
</td>
          </tr>
      </table>
    </td>
  </tr>
</table>
<%
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1

if not rs.eof then
	rs.PageSize = MaxPageSize
	rs.AbsolutePage = PageNo 
	dim i
	i=0   
%>
<script language="JavaScript" type="text/JavaScript">
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
</script>
<table width="760" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight=#8cc3de bordercolordark=#FFFFFF class="main_tdbg">
  <form action="admin_manage.asp?Action=delall" method=post name=form1><tr align="center" class="main_title1"> 
    <td width="100">Qzone名称</td>
    <td width="100">Qzone头像</td>
    <td width="100">Qzone类别</td>
    <td width="100">Qzone登记时间</td>
    <td width="100">开始统计时间</td>
    <td width="100">最后点入时间</td>
    <td width="100">最后点出时间</td>
  </tr>
  <%Do While Not rs.EOF and i<MaxPageSize%>
  <tr align="center"> 
    <td><a href="http://<%=hx.BaseUrl%>out.asp?username=<%=rs("username")%>" target="_blank"><%=rs("sitename")%></a></td>
    <td><a href="http://<%=hx.BaseUrl%>out.asp?username=<%=rs("username")%>" target="_blank"><img src=<%=hx.htmlencode2(rs("sitelogo"))%> width=88 height=31 alt="Qzone地址:<%=hx.htmlencode2(rs("siteurl"))%>" border="0"></a></td>
    <td><%=hx.showwebtype(rs("webtype"))%></td>
    <td><%=rs("dateandtime")%></td>
    <td><%=rs("fromdate")%></td>
    <td><%=rs("indate")%></td>
    <td><%=rs("outdate")%></td>
  </tr>
  <tr> 
    <td align="center">Qzone地址</td>
    <td colspan="3"><a href="out.asp?username=<%=rs("username")%>" target="_blank"><%=hx.htmlencode2(rs("siteurl"))%></a></td>
    <td align="center">邮 箱</td>
    <td colspan="2"><a href="mailto:<%=rs("email")%>"><%=rs("email") %></a></td>
  </tr>
  <tr> 
    <td align="center">简 介</td>
    <td colspan="6"><%=hx.htmlencode2(rs("siteintro"))%></td>
  </tr>
  <tr> 
    <td align="center">贡献统计</td>
    <td colspan="6"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="50%">[你站]对[我站]:总计 <%=rs("inc")%> 今天 <%=rs("inj")%> 平均 <font color=#00009F><%=formatnumber(rs("inp"),2,-1)%></font></td>
          <td width="50%">[我站]对[你站]:总计 <%=rs("outc")%> 今天 <%=rs("outj")%> 平均 <font color=#00009F><%=formatnumber(rs("outp"),2,-1)%></font></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td bgcolor="#FDF0F9" align="center"><input type="checkbox" name="delID" value="<%=rs("ID")%>">
    管理      </div></td>
    <td colspan=6 bgcolor="#FDF0F9"><a href="admin_editlink.asp?username=<%=rs("username")%>">修改</a> <a href="?Action=delall&delid=<%=rs("ID")%>" onClick="return confirm('确定要删除吗?')">删除</a> <a href="?action=init&username=<%=rs("username")%>" onClick="return confirm('初始化后,此网站数据将清零,你确认要继续吗?')">初始化统计</a> 
      <a href="?action=ShowLog&username=<%=rs("username")%>&inout=0">查看点入记录</a> 
      <a href="?action=ShowLog&username=<%=rs("username")%>&inout=1">查看点出记录</a></td>
  </tr>
  <tr bgcolor="#0099CC"> 
    <td height="5" colspan=7></td>
  </tr>
  <%  
i=i+1  
rs.MoveNext  
Loop  
%>
<tr bgcolor="#9D9090"><td align="center" bgcolor="#3399CC"><input type='checkbox' name=chkall onclick='CheckAll(this.form)'>
全选</td>
  <td colspan=6 bgcolor="#3399CC"><input type="submit" name="Submit" value="删除所选择的" onClick="{if(confirm('该操作不可恢复!\n\n确定删除选定的记录?')){this.document.form1.submit();return true;}return false;}"></td>
</tr></form>
<%
else
%>
  <tr> 
    <td height=80 colspan=7> <div align="center"><B>没有找到你所查询的Qzone站</B></div></td>
  </tr>
  <%
end if  
rs.close
set rs=nothing

%>
</table>
<%end sub%>
<%sub BatchDelform%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td><form name="form1" method="post" action="?action=BatchDelWeb">
        删除初始化后 
        <input name="daynum" type="text" value="30" size="3" maxlength="4">
        天内总点击进入数小于 
        <input name="hitsnum" type="text" id="hitsnum" value="1" size="3" maxlength="4">
        的站点 
        <input type="submit" name="Submit" value="删除">
      </form></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td><form name="form1" method="post" action="?action=BatchDelLog">
        删除 
        <input name="daynum" type="text" value="15" size="3" maxlength="4">
        天前的点击记录(用户3天内的点入点出记录不会被删除) 
        <input type="submit" name="Submit" value="删除">
      </form></td>
  </tr>
</table>
<%
Call GoBack
end sub

sub dellink
	dim username
	delid=hx.checkstr(request("delid"),12)
	hx.execute("delete from CL_Link where id="&delid)
	response.write "<p align=center>网站删除成功</p>"
	Call GoBack
end sub

sub delalllink
	dim delid
	delid=replace(request("delid")," ","")
	if delid="" or isnull(delid) then
		Response.write "<BLOCKQUOTE><br><br>操作失败,没有选择合适参数!<A HREF='admin_news.asp'><b>点击返回</b></A><BR><br><meta http-equiv=refresh content=""2;URL=?action=ListSite""></BLOCKQUOTE>"
	else
		conn.execute("delete from CL_Link where Id in ("&delid&")")
		if err.number<>0 then '错误处理
			response.write "数据库操作失败:" & err.description
			err.clear
		else		
			Response.write "<tr><td colspan=8><BLOCKQUOTE><br><br>记录删除成功!<A HREF='admin_manage.asp?action=ListSite'><b>点击返回</b></A><BR><br><meta http-equiv=refresh content=""2;URL=admin_manage.asp?action=ListSite""></BLOCKQUOTE></td></tr>"
		end if
	end if
end sub
sub init
	dim username
	username=hx.checkstr(request("username"),12)
	if username="" then
		hx.execute("update CL_Link set inc=0,inj=0,inp=0,outc=0,outj=0,outp=0,fromdate=date(),indate=date(),outdate=date()")
		response.write "<p align=center>初始化完毕!所有数据已清零,从今天起开始重新统计!</p>"
	else
		hx.execute("update CL_Link set inc=0,inj=0,inp=0,outc=0,outj=0,outp=0,fromdate=date(),indate=date(),outdate=date() where username='"&username&"'")
		response.write "<p align=center>"&username&"的站点初始化完毕!所有数据已清零,从今天起开始重新统计!</p>"	
	end if
	Call GoBack
end sub

sub BatchDelWeb
	dim rs,daynum,hitsnum,TotalCount
	daynum=request.form("daynum")
	hitsnum=request.form("hitsnum")
	'容错判断
	if daynum="" or not isnumeric(daynum) then daynum=30
	if hitsnum="" or not isnumeric(hitsnum) then hitsnum=1
	'开始删除	
	set rs=hx.execute("select count(*) from CL_Link where fromdate<"&SqlNowString&"-"&daynum&" and inc<"&hitsnum)
	TotalCount=rs(0)
	set rs=nothing
	if TotalCount>0 then
		hx.execute("delete from CL_Link where fromdate<"&SqlNowString&"-"&daynum&" and inc<"&hitsnum)	
		response.write "成功删除了" & TotalCount &"个站点"
	else
		response.write "暂时没有符合删除条件的站点"
	end if
	Call GoBack
end sub

sub BatchDelLog
	dim rs,daynum,TotalCount
	daynum=request.form("daynum")
	'容错判断
	if daynum="" or not isnumeric(daynum) then daynum=15
	if daynum<=3 then daynum=15	
	'开始删除	
	set rs=hx.execute("select count(*) from CL_Log where dateandtime<"&SqlNowString&"-"&daynum)
	TotalCount=rs(0)
	set rs=nothing
	if TotalCount>0 then
		hx.execute("delete from CL_Log where dateandtime<"&SqlNowString&"-"&daynum)	
		response.write "成功删除了" & TotalCount &"条记录"	
	else
		response.write "暂时没有符合删除条件的记录"
	end if
	Call GoBack
end sub

sub ShowLog
	dim rs,sql
	dim inout
	dim username
	dim strtitle
	username=hx.checkstr(request.QueryString("username"),12)
	inout=request.QueryString("inout")
	if inout="0" then
		strtitle="点入记录(你站对我站的贡献)"
	elseif inout="1" then
		strtitle="点出记录(我站对你站的贡献)"
	else
		strtitle="点入点出记录"		
	end if
	
	dim PageNo
	PageNo=Request.QueryString("PageNo")
	if PageNo="" or not isnumeric(PageNo) then
		PageNo=1
	else
		PageNo=int(PageNo)
	end if
	dim condition,linkstr
	if username="" then
		if inout="" then
			condition=""
			linkstr="action=ShowLog"
		else
			condition="where inout="&inout
			linkstr="action=ShowLog&inout="&inout
		end if		
	else
		strtitle= "<a href=admin_editlink.asp?username="&username&" title='查看"&username&"的Qzone资料'>"&username&"</a>的Qzone的" & strtitle
		if inout="" then
			condition="where username='"&username&"'"
			linkstr="action=ShowLog&username="&username
		else		
			condition="where inout="&inout &" and username='"&username&"'"
			linkstr="action=ShowLog&inout="&inout &"&username="&username
		end if	
	end if
	if inout<>"" then
		
	end if
%>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="0">
  <tr> 
    <td><div align="center"><%=strtitle%></div></td>
  </tr>
</table>
<table width="95%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
  <tr align="center"> 
  <%if username="" then response.write "<td width=100>用户名</td>"
if inout="" then response.write "<td width=30 align=center>状态</td>"
  %>
    <td width="120">时间</td>
    <td width="100">IP地址</td>
    <td>来源页面</td>
  </tr>
  <%
	set rs=server.createobject("adodb.recordset")
	sql="select * from CL_Log "&condition&" order by id desc"
	rs.open sql,conn,1,1
	if rs.eof then
		Response.write "<tr><td colspan=3 align=center>暂时还没有记录</td></tr>"
	else
		rs.PageSize = MaxPageSize
		rs.AbsolutePage = PageNo 
		dim i
		i=0   
		do while not rs.eof and i<MaxPageSize
	%>
  <tr>
<%if username="" then response.write "<td><a href=?action=ShowLog&username="&rs("username")&">"&rs("username")&"</a></td>"
if inout="" then
response.write "<td width=30 align=center>"
		response.write "<a href=?action=ShowLog&username="&username&"&inout="&rs("inout")&"><font color=#000000>"
	if rs("inout")=0 then
		response.write "点入"
	else
		response.write "点出"
	end if
		response.write "</font></a>"
response.write "</td>"
end if
 %>
    <td><%=rs("dateandtime")%></td>
    <td><%="<a href='http://www.itlearner.com/ip/ipinfo.asp?ip="&rs("ip")&"' title='查询此IP地址所在区域' target='_blank'>"&rs("ip")&"</a>"%></td>
    <td> <%if trim(rs("come"))="" then
		  	response.write "无"
		  else
		  	response.write "<a href="&rs("come")&" target=_blank>"&rs("come")&"</a>"
		  end if%> </td>
  </tr>
  <%
		i=i+1
		rs.movenext
		loop
	end if
	set rs=nothing%>
</table>
<p align=center>
  <%hx.showPageInfo "CL_Log","id",condition,PageNo,MaxPageSize,linkstr%>
</p>

<%
Call GoBack
end sub%>
<%
Sub Compact
		Response.Write CompactDB(Server.Mappath(db),false)
		Response.write "<p align=center><< <a href=javascript:history.go(-1)>返回上一页</a></p>"	
End Sub
'=====================压缩参数=========================
Function CompactDB(dbPath, boolIs97)
	On Error Resume Next
	Dim fso, Engine, strDBPath,JET_3X
	strDBPath = left(dbPath,instrrev(DBPath,"\"))
	Set fso = CreateObject("Scripting.FileSystemObject")
	If Err Then
		Err.Clear
		CompactDB = "您当前操作的目录不支持FSO,请手动进行压缩数据库操作!" & vbCrLf
		Exit Function
	End If
	If fso.FileExists(dbPath) Then
		fso.CopyFile dbpath,strDBPath & "temp.mdb"
		Set Engine = CreateObject("JRO.JetEngine")

		If boolIs97 = "True" Then
			Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
			"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb;" _
			& "Jet OLEDB:Engine Type=" & JET_3X
		Else
			Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
			"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
		End If

		fso.CopyFile strDBPath & "temp1.mdb",dbpath
		fso.DeleteFile(strDBPath & "temp.mdb")
		fso.DeleteFile(strDBPath & "temp1.mdb")
		Set fso = Nothing
		Set Engine = Nothing
		CompactDB = "你的数据库, " & dbpath & ", 已经压缩成功!" & vbCrLf
	Else
		CompactDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
	End If
End Function

Sub ClearCache
	response.write "<p align=center>删除本系统缓存成功</p>"
	hxcache.DelCahe("js")
	Call GoBack
End Sub

Sub GoBack
	Response.Write "<p align=center><< <a href='javascript:history.go(-1)'>返回上一页</a></p>"	
End Sub
%>
</td>
</tr>
</table> 
<%CloseDatabase%>
<!--#include file="under.asp"-->