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

📄 admin_check.asp

📁 这是一个ASP+VBScript+Access开发的网上家园源程序
💻 ASP
字号:
<!--#include file="connect.asp" -->
<!--#include file="..\include\md5.asp" -->
<!--#include file="..\include\nosqlin.asp" -->
<!--#include file="..\include\functions.asp" -->
<%
if request.Cookies("admin") = "" then
user = request.form("username")
'password = md5(request.form("pass"))
password = request.form("pass")
'response.write user &"/"&password
'response.end
strSQL = "select * from information where user = '"&user&"' and password = '"&password&"'"
'response.write "strSQL:"&strSQL

set rs = objCnn.Execute(strSQL)
'response.end

if rs.eof then
	msg = "用户名或密码错误!"
%>
<Script language=VBScript>
msgbox "<%=msg%>"
history.back
</Script>
<%
response.end
else
	response.Cookies("admin") = rs("admin")
	response.Cookies("user") = user
	response.Cookies("password") = password
	
end if
rs.close
set rs=nothing
else
user = request.Cookies("user")
password = request.Cookies("password")
strSQL = "select * from information where user = '"&user&"' and password = '"&password&"'"
set rs = objCnn.Execute(strSQL)
end if

Page=request("page")
if Page="" then Page=1

dim rs1,rs2
set rs1=server.createobject("adodb.recordset")
set rs2=server.createobject("adodb.recordset")
set rs3=server.createobject("adodb.recordset")
%>
<html>
<head>
<BASE onmouseover=window.status="<%=Unit%>个人主页空间——您理想的网上家园!";return true>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title><%=Unit%>>><%=softname%></title>
<style type="text/css">
<!--
a:link {
	color: #333333;text-decoration:none
}
a:visited {
	color: #666666;text-decoration:none
}
a:active {
	color: #999999;text-decoration:none
}
A:hover {
	color: #FF0000;text-decoration:underline
	}
-->
</style>
<SCRIPT LANGUAGE=javascript>
<!--
function openurl(url)
{                                                
	window.open(url,"公告管理","Menubar=no,directories=no,status=no,scrollbars=yes,resizable=no,Width=600,Height=400");                                                
}

function openurl1(url)
{                                                
	window.open(url,"清理图片","Menubar=no,directories=no,status=no,scrollbars=yes,resizable=no,Width=60,Height=40");                                                
}
-->
</Script>
</head>

<BODY bgcolor="#E1EBF4" style="font-size: 9pt">
<!--#include file="head.asp" -->
<!--#include file="NavBar.Asp" -->
<%
select case request("action")
Case "修改"	
	response.redirect "admin_user_mod.asp?ID="&request("ID")&"&page="&page

Case "删除"  '删除用户信息和用户目录
	strSQL = "select user from information where id in ("&request("ID")&")"
	rs1.open strSQL,objCnn,1,3
	do while not rs1.eof
		usern=usern & "'" & rs1("user") & "',"
		
		'删除虚拟目录
		strServerDir="IIS://LocalHost/W3SVC/1/Root"
		Delete_vDir rs1("user"),strServerDir

		rs1.movenext
	loop 
	rs1.close
	usern=left(usern,len(usern)-1)

	strSQL = "select * from Useraccounts where user in ("&usern&")"
	rs1.open strSQL,objCnn,1,3
	do while not rs1.eof
	dirPath=dirPath & "," & rs1("HomeDir")
	rs1.movenext
	loop
	rs1.close
	dirPath=mid(dirPath,2)
	
	strSQL = "delete * from Useraccounts where user in ("&usern&")" 
	objCnn.Execute(strSQL)
	strSQL = "delete * from information where id in ("&request("ID")&")" 
	objCnn.Execute(strSQL)
	
	'删除相关目录
	Call del_dir_files(dirPath,"Folder") 
Case "激活"
	strSQL = "select user from information where id in ("&request("ID")&")"
	rs1.open strSQL,objCnn,1,3
	do while not rs1.eof
		usern=usern & "'" & rs1("user") & "',"
		rs1.movenext
	loop 
	rs1.close
	usern=left(usern,len(usern)-1)
	
	'设置用户空间及为用户建立虚拟目录
	strSQL = "select * from Useraccounts where user in ("&usern&")"
	rs1.open strSQL,objCnn,1,3
	do while not rs1.eof
	
		'设置用户空间
		rs1("QuotaMax")=QuotaMax
		
		'建立虚拟目录
		strSDir="IIS://LocalHost/W3SVC/1/Root"
		Create_vDir rs1("user"), rs1("HomeDir"), strSDir
		
		rs1.movenext
	loop
	rs1.update 
	rs1.close
	
	'激活用户
	strSQL = "update information set check = True where id in ("&request("ID")&")"
	objCnn.Execute(strSQL)
	
	
	Response.write "<script>window.location.href=('"& Replace(Request.ServerVariables("HTTP_REFERER"),"\","\\") &"')</script>"
	
Case "锁定"
	strSQL = "select user from information where id in ("&request("ID")&")"
	rs1.open strSQL,objCnn,1,3
	do while not rs1.eof
		usern=usern & "'" & rs1("user") & "',"
		
		'删除虚拟目录
		strServerDir="IIS://LocalHost/W3SVC/1/Root"
		Delete_vDir rs1("user"),strServerDir
		
		rs1.movenext
	loop 
	rs1.close
	usern=left(usern,len(usern)-1)
	
	strSQL = "select * from Useraccounts where user in ("&usern&")"
	rs1.open strSQL,objCnn,1,3
	do while not rs1.eof
		rs1("QuotaMax")=QuotaMax0
		rs1.movenext
	loop 
	rs1.update 
	rs1.close
	
	strSQL = "update information set check = False where id in ("&request("ID")&")"
	objCnn.Execute(strSQL)
	Response.write "<script>window.location.href=('"& Replace(Request.ServerVariables("HTTP_REFERER"),"\","\\") &"')</script>"
end select
%>
<table border="0" width="750" style="border: 1 solid #000000" cellspacing="0" cellpadding="4" height="70%">
  <tr>
    <td width="100%">
<div align="center">
  <table border="0" width="96%" height="100%" style="font-size: 9pt">
    <tr>
      <td width="16%" style="border-right: 1 solid #C0C0C0" valign="top">
         
        <table border="0" width="100%" style="font-size: 9pt">
          <tr>
            <td width="100%"><b>管理员</b><b>:<%=rs("username")%></b></td>
          </tr>
          <tr>
            <td width="100%">&nbsp;◆ <a href="admin_mod.asp"> 修改信息</a></td>                                                                                              
          </tr>
          <tr>
            <td width="100%">&nbsp;◆ <a href="quit.asp">退出</a></td>                                                                                               
          </tr>
          <tr>
            <td width="100%"><b>&nbsp;</b></td>
          </tr>
          <tr>
            <td width="100%"><b>管理功能</b></td>
          </tr>
          <tr>
            <td width="100%">&nbsp;◆ <a href="admin_user.asp">用户查看</a></td>                                                                                              
          </tr>
          <tr>
            <td width="100%">&nbsp;◆ <a href="admin_check.asp"> 用户审核/管理</a></td>                                                                                             
          </tr>
          <tr>
            <td width="100%">&nbsp;◆ <a href="shenqing.asp"> 添加用户</a></td>                                                                                              
          </tr>
          <tr>
            <td width="100%">&nbsp;◆ <a href="javascript:openurl('affiche_manage.asp');">公告管理</a></td>                              
          </tr>
          <tr>
            <td width="100%">&nbsp;◆ <a href="javascript:openurl1('P_Clear.asp');">清理图片</a></td>                            
          </tr>
          <tr>
            <td width="100%">&nbsp;</td>
          </tr>
        </table>
      </td>
      <center>
      <td width="84%" valign="top" style="font-size: 9pt">
<p align="center">
<%
CurrentPage=request("page")
if CurrentPage="" then CurrentPage=1
strSQL = "select * from information where admin > 1 order by check desc, user"
rs1.open strSQL,objCnn,1,3
    MaxPerPage=20
    RS1.PageSize= MaxPerPage
    
   	if not isempty(request("page")) and request("page")<>"" then
			currentPage=cint(request("page"))
   		else
      		currentPage=1
   	end if
    
    totalPut = Rs1.recordcount 
    if totalPut > 0 then
      	if currentpage < 1 then currentpage=1 
	 	RS1.AbsolutePage = currentpage
	end if
%>
<b><font color="#008080"><br>
用户管理</font></b><br>
<div align="right" style="width: 589; height: 125">
<form name=selform>
        <table border="1" width="100%" style="font-size: 9pt; border-style: solid; border-width: 0" cellspacing="0" cellpadding="2" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF">
          <tr height="26">
            <td align="center"><b>选择</b></td>
            <td align="center"><b>用户名</b></td>
            <td align="center"><b>姓名</b></td>
            <td align="center"><b>E-Mail</b></td>
            <td align="center"><b>电话</b></td>
            <td align="center"><b>主页</b></td>
            <td align="center">注册时间</td>
            <td align="center"><b>状态</b></td>
          </tr>
<%
for i=1 to MaxPerPage%>
          
<tr <%if not rs1("check") then%> bgcolor="#FEF3F1"<%end if%>>
            <td>
              <p align="center"><input type="checkbox" name="ID" value="<%=rs1("ID")%>"></p>
            </td>
            <td><%=rs1("user")%></td>
            <td><%=rs1("username")%></td>
            <td>
              <p align="center"><a href="mailto:<%=rs1("email")%>"><img border="0" src="../images/MAIL.GIF" title='<%=rs1("tel1")%>'></a></p>
            </td>
            <td ><%if rs1("tel")<>"" then%><%=rs1("tel")%><%else%><%=rs1("tel1")%><%end if%></td>
            <td><%=rs1("wwwname")%></td>
            <td>
              <p align="center"><%=rs1("CreateDate")%></td>
            <td>
              <p align="center"><%if rs1("check") then%>激活<%else%><font color=red>锁定</font><%end if%></p>
            </td>
          </tr>
<%
rs1.movenext
if rs1.eof then exit for
next
%>
</table>
<BR>
<%
showpage rs1.recordcount,MaxPerPage,"admin_check.asp" 
%>
<div align="center">
<center>
<table cellpadding="2"><br>
  管理操作:   
              <input onClick="{if(confirm('确定修改选定的用户吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=修改 name=action>   
              <input onClick="{if(confirm('确定删除选定的用户吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=删除 name=action> 
              <input onClick="{if(confirm('确定激活选定的用户吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=激活 name=action>   
              <input onClick="{if(confirm('确定锁定选定的用户吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=锁定 name=action>   
</table>
</center>
</div>
        <input type="hidden" name="page" value="<%=page%>">
</form>
</div>
</td></tr></table></table>
<!--#include file="..\food.asp" -->
</body>
<%
	function showpage(totalnumber,maxperpage,filename)
  	dim n

  	if totalnumber mod maxperpage=0 then
     		n= totalnumber \ maxperpage
  	else
     		n= totalnumber \ maxperpage+1
  	end if
  	
  	response.write "<table cellspacing=1 width='100%' border=0 colspan='4' style='font-size: 9pt'><tr><td align=right> "
  	if CurrentPage < 2 then
    		response.write "共 "&totalnumber&" 位用户&nbsp;首页 上一页&nbsp;"
  	else
    		response.write "共 "&totalnumber&" 位用户&nbsp;<a href='"&filename&"?page=1'>首页</a>&nbsp;"
    		response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a>&nbsp;"
  	end if

  	if n-currentpage<1 then
    		response.write "下一页 尾页"
  	else
    		response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
    		response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
  	end if
   	response.write "&nbsp;页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
    response.write "&nbsp;<b>"&maxperpage&"</b>位用户/页 </td></tr></table>"
end function

'创建虚拟目录函数
sub Create_vDir(strVRName, strRootPath, strServerDir)
Set objVirtualDir=GetObject(strServerDir)
Set VirDir=objVirtualDir.Create("IISWebVirtualDir",strVRName)
VirDir.AccessRead=true
VirDir.Path=strRootPath
VirDir.AccessExecute=true
VirDir.appcreate 0
VirDir.CreateProcessAsUser=0
VirDir.setInfo
set objVirtualDir=nothing
set VirDir=nothing
end sub

'删除虚拟目录函数
sub Delete_vDir(strVRName, strServerDir)
Set objVirtualDir=GetObject(strServerDir)
objVirtualDir.Delete "IISWebVirtualDir",strVRName
set objVirtualDir=nothing
end sub
%>











⌨️ 快捷键说明

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