www.gusucode.com > 要听音乐网完美修正版 1.0源码程序 > admin/Admin_index.asp

    <!--#include file="../inc/const.asp"-->
<!--#include file="inc/char.asp"-->
<!--#include file="inc/Md5.asp" -->
<%
DataConn()
Version="<br><div align=center>"&Version&"</div>"
Select Case Lcase(Request("action"))
	Case "admin_login"
	     Call Admin_login()
	Case "chklogin"
	     Call Admin_login()
	     Call chklogin()
	Case "loginout"
	     Call loginout()
    Case "admin_left"
	     Call Admin_left()
    Case "admin_main"
	     Call Admin_main()
    Case "admin_head"
	     Call Admin_head()
    Case Else
	     Call Main()
End Select

DataClose()

Sub Main()
%>
<html>
<head>
<title><%=site_info(0)%>--控制面板</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<%
If session("master")="" Then
   Call Admin_login()
Else%>
<frameset rows="25,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
<frame src="Admin_index.asp?action=Admin_head" name="head" scrolling="NO" NORESIZE frameborder="0" marginwidth="10" marginheight="0" border="no">


<frameset cols="180,*" frameborder="no" border="0" framespacing="0" rows="*"> 
  <frame name="leftFrame" scrolling="yes" noresize src="Admin_index.asp?action=Admin_left" marginwidth="0" marginheight="0">

<frame name="main" src="Admin_index.asp?action=Admin_main" scrolling="AUTO" NORESIZE frameborder="0" marginwidth="10" marginheight="10" border="no">
</frameset>
<%End If%>
</frameset>
<noframes>
</body></noframes>
</html>
<%
End Sub

Sub Admin_left()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=site_info(0)%></title>
<link href="css.css" type="text/css" rel="stylesheet">
</head>
<body  topmargin=0 leftmargin=0 bgcolor=#E5E5E5>
<SCRIPT language="JavaScript" type="text/javascript">
<!--
function ToggleNode(nodeObject, imgObject){
         if (nodeObject.style.display == '' || nodeObject.style.display == 'inline') {
             nodeObject.style.display = 'none';
             imgObject.src = '../images/collapse.gif';
         } else {
             nodeObject.style.display = 'inline';
             imgObject.src = '../images/expand.gif';
         }
}
function Upload()
{
	window.open("Admin_upload.asp","Upload","left=0,top=0,width=400,height=280,status=1");
}
-->
</SCRIPT>
<table cellpadding=0 cellspacing=1 width=95% align=center border="0" align="center">
  <tr>
    <td bgcolor="#f6f6f6" align="center" height="30">
	  后台管理控制面板
	</td>
  </tr>
</table>
<%
If Session("Super")="0" Then
	If Session("Flag")="" Or isNull(Session("Flag")) Then
		Response.Write "<br><div align=center><font color=red>管理员尚未给你分配权限!</font></div>"
		Exit Sub
	End If
End If
Dim tempStr,k,cRs,ID
k=0
'response.Write scriptname
'response.End
If Session("Super")="0" Then tempStr=" And ID In("&Session("Flag")&")"
SQL="Select ID,MenuName,ScriptName,ParentID From "&TableAdminMenu&" Where isOpen=1 And ParentID=0"&tempStr&" Order By ID"
Set Rs=Conn.Execute(SQL)
If Not Rs.EOF Then
	Do Until Rs.EOF
		ID=Rs(0)
%>
<table cellspacing=1 cellpadding=0 width="95%" border=0 align="center">
  <tbody>
    <tr id=root> 
      <td>
        <table cellspacing=0 cellpadding=0 width="100%" border=0>
          <tbody>
            <tr> 
              <td bgcolor=#006699> <img
                    id=nav_img_<%=k%> style="cursor: hand"
                    onclick=ToggleNode(nav_tr_<%=k%>,nav_img_<%=k%>) hspace=2 
                    src="../images/expand.gif" 
                    align=absmiddle vspace=2>
		        <Font style="color:#ffffff;font-weight:bold"><%=Rs(1)%></font>
              </td>
            </tr>
			<tr id=nav_tr_<%=k%>>
              <td>
			<%
			SQL="Select MenuName,ScriptName From "&TableAdminMenu&" Where ParentID="&ID&" And isOpen=1"&tempStr&" Order By Orders"
			Set cRs=Conn.Execute(SQL)
			If Not cRs.EOF Then
				Do Until cRs.EOF
			%>
			  <table cellspacing=1 cellpadding=2 width="100%" border=0>
                  <tbody>
                    <tr id=cat onmouseover="this.bgColor='#EEEEEE';" 
                       onmouseout="this.bgColor='#FFFFFF';" 
                       bgColor=#ffffff> 
                      <td> <img hspace=2 src="../images/blank.gif" width="16" height="16" align=absmiddle><a href="<%=cRs(1)%>" target=main><%=cRs(0)%></a>
                      </td>
                    </tr>
                  </tbody>
                </table>
			<%
					cRs.MoveNext
				Loop
			End If%>
			  </td>
            </tr>
          </tbody>
        </table>
      </td>
    </tr>	
  </tbody>
</table>
<%				k=k+1
			Rs.MoveNext
		Loop
	End If
	Set cRs=Nothing
	Set Rs=Nothing
End sub

Sub Admin_head()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=site_info(0)%></title>
<link href="css.css" type="text/css" rel="stylesheet">
</head>
<body  topmargin=0 leftmargin=0 bgcolor=#006699>
<table width="100%" align=center cellpadding=0 cellspacing=0 border=0>
<tr>
<td height="23" valign=middle><Font color=white>→ 欢迎 <b><%=session("master")%></b> 进入控制面板</font> </td>
<td valign=middle></td>
<td valign=middle align=right><a href=Admin_index.asp?action=loginout target=_top style="color:white">退出后台</a>&nbsp;&nbsp; <a href="Admin_Index.Asp?Action=admin_login" target=_top style="color:white">重新登陆</a>&nbsp;&nbsp; <a href="../" target=_top style="color:white">返回 首页</a>&nbsp;&nbsp;</td>
</tr>
</table>
</body>
</html>
<%
End Sub

Sub Admin_main()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=site_info(0)%></title>
<link href="css.css" type="text/css" rel="stylesheet">
</head>
<body  topmargin=0 leftmargin=0 bgcolor=#E5E5E5>
<br>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" class="border-all">
  <tr> 
    <th colspan="2">快 捷 方 式</th>
  </tr>
  <tr class="table_row_1"> 
    <td width="50%" colspan="2" align="center">
	
	</td>
  </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" class="border-all">
  <tr> 
    <th colspan="2">系 统 信 息</th>
  </tr>
  <tr class="table_row_1"> 
    <td width="50%">服务器类型:<%=Request.ServerVariables("OS")%>(IP:<%=Request.ServerVariables("LOCAL_ADDR")%>)</td>
    <td width="50%">脚本解释引擎:<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %></td>
  </tr>
  <tr class="table_row_2"> 
    <td>站点物理路径:<%=request.ServerVariables("APPL_PHYSICAL_PATH")%></td>
    <td>数据库使用: 
      <%
	  If Not testObject("Adodb.Connection") Then
	     Response.Write "<b>×</b>"
      Else 
         Response.Write "<font style='color:red;font-weight:bold'>√</font>"
      End If
	  %>
    </td>
  </tr>
  <tr class="table_row_1"> 
    <td>FSO文本读写: 
      <%
	  If Not testObject("scripting.filesystemobject") Then
	     Response.Write "<b>×</b>"
      Else 
         Response.Write "<font style='color:red;font-weight:bold'>√</font>"
      End If
	  %>
    </td>
    <td>MDAC版本:<%=Conn.Version%></td>
  </tr>
</table>
<br>
<%
Dim ArticleCount,Article_NoCheck,ClassCount
Set Rs=Conn.execute("Select Count(NClassID) FROM "& TableNClass &"")
ArticleCount=Rs(0)

Set Rs=Conn.execute("Select Count(SpecialID) FROM "& Tablespecials &"")
Article_NoCheck=Rs(0)

Set Rs=Conn.execute("Select Count(ID) FROM "& TableClass &"")
ClassCount=Rs(0)

Set Rs=Nothing
%>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" class="border-all">
  <tr> 
    <th colspan="2">数 据 统 计</th>
  </tr>
  <tr class="table_row_1"> 
    <td width="50%">共有歌手:<b><font color="#FF0000"><%=ArticleCount%> 位</font></b> 
    </td>
    <td width="50%">共有专辑:<font color="#FF0000"><b><%=Article_NoCheck%> 张</b></font></td>
  </tr>
  <tr class="table_row_2"> 
    <td>共有歌曲:<b><font color="#FF0000"><%=ClassCount%> 首</font></b></td>
    <td>数据库大小:<b><font color="#FF0000"><%=GetFileSize(DataBaseName)%></font></b></td>
  </tr>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" class="border-all">
  <tr> 
    <th colspan="2">程 序 相 关 信 息</th>
  </tr>
  <tr class="table_row_1"> 
    <td width="50%">程序开发:rubyou<font color="#FF0000"><b></b></font></td>
    <td width="50%">官方网站:<a href="http://www.im286.com" target="_blank">http://www.im286.com</a></td>
  </tr>
  <tr class="table_row_2"> 
    <td>QQ:63740</td>
  </tr>
</table>
<br>
</body>
</html>
<%
    Response.Write Version
End sub

Session("Rand")=GetRand(4)
Sub Admin_login()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=site_info(0)%></title>
<link href="css.css" type="text/css" rel="stylesheet">
</head>
<body  topmargin=0 leftmargin=0 bgcolor=#E5E5E5>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="50%" border=0 align="center" cellpadding=5 cellspacing=1 class="border-all">
  <tbody>
    <tr> 
      <th height=21 sytle="line-height:150%" align="center"> <b>&nbsp;管理登陆</b></th>
    </tr>
    <tr> 
      <td align=center bgcolor=#ffffff height="40"> <table width="95%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td height="5"></td>
          </tr>
          <tr> 
            <td> 
              <form name="myform" method="post" action="?action=chklogin">
                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr> 
                    <td width="25%"><font face="Arial, Helvetica, sans-serif">用户名:</font></td>
                    <td width="75%" height="35"> <input type="text" name="username" class="editbox" size="20"> 
                    </td>
                  </tr>
                  <tr> 
                    <td width="25%"><font face="Arial, Helvetica, sans-serif">密码:</font> 
                    </td>
                    <td width="75%" height="35"> <input type="password" name="password" class="editbox" size="20" value=""> 
                    </td>
                  </tr>
<%If EnableVerifyCode = 1 Then%>
                  <tr> 
                    <td>验证码:</td>
                    <td height="35"><input name="verifycode" type="text" class="editbox" id="verifycode" value="" size="20"><img src="show_verifycode.asp"></td>
                  </tr>
<%End If%>
                  <tr> 
                    <td height="40" colspan="2" id="strMsg">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="22" colspan="2"><input type="submit" name="Submit" value="提交" class="button"> 
                      &nbsp; <input type="reset" name="Submit2" value="重置" class="button">
                      <input name="action" type="hidden" id="action" value="chklogin"> </td>
                  </tr>
                </table>
                </form></td>
          </tr>
        </table></td>
    </tr>
  </tbody>
</table>
</body>
</html>
<%
    Response.Write Version
End Sub

Sub Loginout()
    Session.Abandon
    Response.Redirect "../"
End Sub

Sub Chklogin()
    Dim Username,Password,Flag,Super
    Username=CheckStr(Request.Form("Username"))
    Password=CheckStr(Request.Form("Password"))
    Sql="Select * FROM "& TableAdmin &" Where Username='"&Username&"' And Password='"&Md5(Password)&"'"
    Set rs=conn.execute(sql)
    If Rs.Eof Or Rs.Bof Then
        strMsg=strMsg&"<li><font color=red>错误的用户名或密码</font>"
    Else
        UserName=Rs("UserName")
        Flag=Rs("Flag")
		Super=Rs("Super")
    End If
    Set Rs=Nothing

	If EnableVerifyCode = 1 Then
	    If Request.Form("Verifycode")<>Session("Rand") Then
		    strMsg=strMsg&"<li><font color=red>请刷新本页,重新输入正确的验证码! <a href=Admin_index.asp target=_top>[刷新]</a></font>"
		End If
	End If

    If strMsg<>"" Then 
	    Session("rand")=""
        Response.Write "<script language=javascript>strMsg.innerHTML='"&strMsg&"'</script>"
    Else
        Session("Master")=UserName
        Session("Flag")=Flag
		Session("Super")=Super
        Response.Redirect "Admin_index.asp"
    End If
End Sub

Function testObject(str)
    On Error Resume Next
    testObject = False
    Dim TestObj
    Set TestObj = Server.CreateObject(str)
    If Err.Number=0 Then testObject=True
    Set TestObj = Nothing
    Err.Clear
End Function

Function GetFileSize(file)
	If isSQL = 0 Then
		Dim fso,fs,GetFile
		On Error Resume Next
		Set Fso = Server.CreateObject(FsoString)
		Set GetFile=fso.getfile(server.mappath(file))
		If Err Then 
			GetFileSize="未知"
			Err.Clear
			Exit Function
		End If
		GetFileSize=GetFile.Size/1024 &" KB"
		Set getfile=nothing
		Set fso=nothing
	Else
		GetFileSize="未知"
	End If
End Function

Function GetRand(Num)
    Dim R
    Randomize
    For R=1 To Num
        Getrand=Getrand & Int(10*Rnd)
    Next
End Function
%>