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

📄 admin_bbsftpdiraccess.asp

📁 主要实现三大功能:记录统计功能、账号控制功能、文件上载自动校验功能
💻 ASP
字号:
<!--#include file="inc/ftp.asp"-->
<%
	if CheckAdmin()= false then response.end

dim OrderName
OrderName = "orderid"
%>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="admin_bbsftp.asp?css=1" rel=STYLESHEET type=text/css>
<title>BBSFTP Web配置管理</title>
<script language=JavaScript>
function chkchk(obj)
{
	obj.value = (obj.checked?1:0);
}
</script>

</head>
<body bgcolor="#eeeeee" text="#000000" leftmargin="0" topmargin="2" style="SCROLLBAR-FACE-COLOR: #f1f1f1; SCROLLBAR-HIGHLIGHT-COLOR: #9e9e9e; SCROLLBAR-SHADOW-COLOR: #9e9e9e; SCROLLBAR-3DLIGHT-COLOR: #ffffff; SCROLLBAR-ARROW-COLOR: #9e9e9e; SCROLLBAR-TRACK-COLOR: #ffffff; SCROLLBAR-DARKSHADOW-COLOR: #ffffff" link="#000000" vlink="#000000">
<br>
<H1 align='center'>文件路径访问规则管理</H1>
<br>
<hr>
<%
if request("action")="add" then
call add_IPCfg
elseif request("action")="edit" then
call Edit_IPCfg
elseif request("action")="update" then
call addip
elseif request("action")="addip" then
call addip
elseif request("action")="delete" then
call delete_ipcfg()
elseif request("action")="deleteip" then
call deleteip
elseif request("action")="editip" then
call editip
else
call list_IPCfg()
end if

If Err Then
response.write Err.Description
End If
BBSFTP_Footer()

sub delete_ipcfg()
if request("id")<>"" then
LOGconn.execute "delete from FTPDIRAccess where IDX=" & request("id")
end if
call list_IPCfg()
end sub

sub list_IPCfg()
dim rs
set rs = server.createobject("adodb.recordset")
rs.Open "select IDX from FTPDIRAccess group by IDX", LOGconn, 1, 3
response.write "<p align='center'>文件路径访问规则组列表</p><p align='center'>"
response.write "<table border='1' width=200 cellspacing='0' cellpadding='0'>"
response.write "<tr><td width='25%' align='center'>组号</td><td align='center'>操作</td></tr>"
if not(rs.bof and rs.eof) then
rs.movefirst
while not rs.eof
response.write "<tr><td align='center'>" & rs(0) & "</td><td align='center'>[<a href='?action=edit&id=" & rs(0) & "'>编辑</a>]&nbsp;[<a href='?action=delete&id="& rs(0) & "'>删除</a>]</td></tr>"

rs.movenext
wend
end if
%>
<tr><td colspan='2' align='center'><a href='?action=add'>添加组</a></td></tr></table></p>
<%
end sub

sub add_IPCfg()
dim tmpid,iorder
if request("id")="" then
tmpid=-1
else
tmpid=request("id")
end if
iorder = 0

dim fread,fwrite,fappend,fdelete,fexe
dim dlist,dcreate,dremove,dinh
fread=1
fwrite=0
fappend=0
fdelete=0
fexe=0
dlist=1
dcreate=0
dremove=0
dinh=1

%>

<form method="post" action="?action=addip">
<%if request("id")<>"" then
dim rs 
set rs = server.createobject("adodb.recordset")
rs.Open "select max("&OrderName&") from FTPDIRAccess", LOGconn, 1, 3
if rs.bof and rs.eof then
iorder = 2
else
rs.movefirst
iorder = rs(0) + 5
end if
rs.close
set rs=nothing


%>
<input type="hidden" name="id" value="<%=tmpid%>">
<%else%>
<p align='center'><b>添加一个新的文件路径规则组</b></p><br>
<p align='center'>请输入组号:<input type="text" name="id" size="5"><br>
<br>
<font color=red>同时请添加一条文件路径访问规则;</font>
</p>
<%end if%>
<p align='center'>
<table border='1' width='400' cellspacing='0' cellpadding='0'>
<tr><td colspan='4' align='center'>添加一条新的文件路径规则</td></tr>
<tr><td width=150>文件(路径)</td><td width=100>文件访问权限</td><td width=100>路径访问权限</td><td width=50>规则优先级</td></tr>
<tr><td><input type="text" name="ip" size="30" value="c:\ftproot"></td>

<td align="center"><%=getchkstr("fread",fread,fread)%>下载<br><%=getchkstr("fwrite",fwrite,fwrite)%>上传<br>
<%=getchkstr("fappend",fappend,fappend)%>续传<br><%=getchkstr("fdelete",fdelete,fdelete)%>删除<br><%=getchkstr("fexe",fexe,fexe)%>执行
</td>
<td align="center"><%=getchkstr("dlist",dlist,dlist)%>列表<br><%=getchkstr("dcreate",dcreate,dcreate)%>创建<br>
<%=getchkstr("dremove",dremove,dremove)%>删除<br><%=getchkstr("dinh",dinh,dinh)%>继承
</td>
<td align="center"><input type="text" name="orderid" size="5" value="<%=iorder%>"></td></tr>
</table></p>
<p align='center'>
<input type="submit" value="提交" name="B1"></p>
<p>(不含路径的文件名)支持通配符合。其它规则和ServU一样,可参见ServU的帮助;</p>
</form>
<%
end sub

'添加ip函数;
sub addip()
dim tmpid,astr,iorder
if request("id")="" or not isnumeric(request("id")) then
response.write "组号错误!"
exit sub
end if

if request("ip")="" then
response.write "文件路径错误!"
exit sub
end if

if request("orderid")="" then

response.write "优先级错误!"
exit sub
end if
tmpid=request("id")
iorder=request("orderid")
astr=request("ip")
astr = astr & "|"

if request("fread")=1 then
astr = astr & "R"
end if
if request("fwrite")=1 then
astr = astr & "W"
end if
if request("fappend")=1 then
astr = astr & "A"
end if
if request("fdelete")=1 then
astr = astr & "M"
end if
if request("fexe")=1 then
astr = astr & "E"
end if

if request("dlist")=1 then
astr = astr & "L"
end if
if request("dcreate")=1 then
astr = astr & "C"
end if
if request("dremove")=1 then
astr = astr & "D"
end if
if request("dinh")=1 then
astr = astr & "P"
end if

dim rs,ip
set rs = server.createobject("adodb.recordset")
if request("action")="update" then ' update
	ip = request("oldip")
	If LCase(logconn.Properties("DBMS Name")) = "mysql" Then
        	ip = Replace(ip, "\", "\\")
    	End If
	rs.Open "select * from FTPDIRAccess where IDX=" & tmpid & " and AccessString='" & ip & "'", LOGconn, 1, 3
	if not(rs.bof and rs.eof) then
		rs.movefirst
		rs("AccessString")=astr
		rs(OrderName)=iorder
		rs.update
		end if
else ' add
	rs.Open "select * from FTPDIRAccess", LOGconn, 1, 3
	rs.addnew
	rs("IDX")=tmpid
	rs("AccessString")=astr
	rs(OrderName)=iorder
	rs.update
end if

rs.close
set rs=nothing
call edit_IPCfg

end sub

'编辑组函数
sub edit_IPCfg()
dim tmpid
tmpid=request("id")

dim rs
set rs = server.createobject("adodb.recordset")
rs.Open "select * from FTPDIRAccess where IDX=" & tmpid & " order by " & OrderName & "", LOGconn, 1, 3

if rs.bof and rs.eof then
	rs.close
	set rs=nothing
	call list_IPCfg
	exit sub
end if

response.write "<p align='center'>编辑文件路径访问规则组【组号:"&tmpid&"】</p><p align='center'>"
response.write "<table border='1' width=400 cellspacing='0' cellpadding='0'>"
response.write "<tr><td width='55%' align='center'>访问规则</td><td width='15%' align='center'>优先级</td><td width='30%' align='center'>操作</td></tr>"
if not(rs.bof and rs.eof) then
rs.movefirst
while not rs.eof
response.write "<tr><td align='center'>" & rs("AccessString") & "</td><td align='center'>"&rs(OrderName)&"</td><td align='center'>[<a href='?action=editip&id=" & rs("IDX") & "&orderid="& rs(OrderName) &"&ip="&rs("AccessString")&"'>编辑</a>][<a href='?action=deleteip&id="& rs("IDX") & "&ip="&rs("AccessString")&"'>删除</a>]</td></tr>"

rs.movenext
wend
end if
%>
<tr><td colspan='3' align='center'><a href='?action=add&id=<%=tmpid%>'>添加一条新的文件路径规则</a></td></tr></table></p>
<%

end sub

'删除ip函数
sub deleteip()
if request("id")<>"" and request("ip")<>"" then
Dim ip
    ip = Request("ip")
    If LCase(logconn.Properties("DBMS Name")) = "mysql" Then
        ip = Replace(ip, "\", "\\")
    End If
LOGconn.execute "delete from FTPDIRAccess where IDX=" & request("id") & " and AccessString='" & ip & "'"
end if
call edit_IPCfg
end sub

'编辑IP函数
sub editip()
dim tmpip,tmpid,tmpastr,tmpav,ballow
if request("id")="" or request("ip")="" then
call edit_IPCfg
exit sub
end if

tmpastr=request("ip")
tmpid=request("id")
tmpav=split(tmpastr,"|")
tmpip=tmpav(0)
tmpastr=tmpav(1)

dim fread,fwrite,fappend,fdelete,fexe
dim dlist,dcreate,dremove,dinh
fread=0
fwrite=0
fappend=0
fdelete=0
fexe=0
dlist=0
dcreate=0
dremove=0
dinh=0

dim i,ach
for i=1 to len(tmpastr)
	ach = mid(tmpastr,i,1)
	'RWAMELCDP
	if ach="" or ach="" then
	elseif ach="R" or ach="r" then
		fread=1
	elseif ach="W" or ach="w" then
		fwrite=1
	elseif ach="A" or ach="a" then
		fappend=1
	elseif ach="M" or ach="m" then
		fdelete=1
	elseif ach="E" or ach="e" then
		fexe=1
	elseif ach="L" or ach="l" then
		dlist=1
	elseif ach="C" or ach="c" then
		dcreate=1
	elseif ach="D" or ach="d" then
		dremove=1
	elseif ach="P" or ach="p" then
		dinh=1
	end if	
next
%>
<p align='center'>编辑文件路径访问规则</p>
<form method="post" action="?action=update">

<input type="hidden" name="oldip" value="<%=request("ip")%>">
<input type="hidden" name="id" value="<%=tmpid%>">

<p align='center'>
<table border='1' width='400' cellspacing='0' cellpadding='0'>
<tr><td colspan='4' align='center'>编辑文件路径规则</td></tr>
<tr><td width=150>文件(路径)</td><td width=100>文件访问权限</td><td width=100>路径访问权限</td><td width=50>规则优先级</td></tr>
<tr><td><input type="text" name="ip" size="30" value="<%=tmpip%>"></td>

<td align="center"><%=getchkstr("fread",fread,fread)%>下载<br><%=getchkstr("fwrite",fwrite,fwrite)%>上传<br>
<%=getchkstr("fappend",fappend,fappend)%>续传<br><%=getchkstr("fdelete",fdelete,fdelete)%>删除<br><%=getchkstr("fexe",fexe,fexe)%>执行
</td>
<td align="center"><%=getchkstr("dlist",dlist,dlist)%>列表<br><%=getchkstr("dcreate",dcreate,dcreate)%>创建<br>
<%=getchkstr("dremove",dremove,dremove)%>删除<br><%=getchkstr("dinh",dinh,dinh)%>继承
</td>
<td><input type="text" name="orderid" size="5" value="<%=request("orderid")%>"></td></tr>
</table></p>
<p align='center'>
<input type="submit" value="提交" name="B1"></p>
<p>(不含路径的文件名)支持通配符合。其它规则和ServU一样,可参见ServU的帮助;</p>
</form>
<%

end sub

function getchkstr(sname,svalue,bchecked)
dim tmpstr
if bchecked then
tmpstr="<input type='checkbox' value='"&svalue&"' checked name='"&sname&"' LANGUAGE=javascript onclick='return chkchk(this)'>"
else
tmpstr="<input type='checkbox' value='"&svalue&"' name='"&sname&"' LANGUAGE=javascript onclick='return chkchk(this)'>"
end if
getchkstr=tmpstr
end function
%>

⌨️ 快捷键说明

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