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

📄 admin_bbsftpftp.asp

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

<br>
<H1 align='center'>Ftp配置管理</H1>
<br>

<%
if request("action")="add" then
call Add_Ftp

elseif request("action")="edit" then
call Edit_Ftp
elseif request("action")="editlog" then
call EditLog_Ftp
elseif request("action")="update" then
call Update_Ftp
elseif request("action")="updatelog" then
call UpdateLog_Ftp
elseif request("action")="delete" then
call deleteftp()
else
call list_Ftp
end if

If Err Then
response.write Err.Description
End If

BBSFTP_Footer()


sub list_Ftp()
dim rsFTP,iid,clr
set rsFTP = server.createobject("adodb.recordset")
rsFtp.Open "select * from FTPConfig", LOGconn, 1, 3
%>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center style="table-layout:fixed;word-break:break-all">
<tr>
<td colspan=2 height=25 class="forumRowHighlight"> 
<b>注意: <font color=blue>如果角色名显示为<font color=red>红色</font>,表示该角色尚未配置,请点击进行配置.</font></b>
</td>
</tr>
</table><BR>

<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center style="table-layout:fixed;word-break:break-all">
<FORM METHOD=POST ACTION="?action=toftp"> 
    <tr  align=center>
<th width="5%" height=25>选择</th>    
<th width="25%">FTP名称</th>
<th width="13%">角色名</th>
<th width="20%">地址端口</th>
<th width="9%">单价</th>
<th width="13%">公共帐号</th>
<th width="15%">操作</th>
            
</tr>
<%
if not (rsFtp.bof and rsFtp.eof) then
	rsFtp.Movefirst
	while not rsFtp.eof
	iid = CheckLinkName(rsFtp("linkname"))
	if iid<1 then
		clr = "red"
	else
		clr = "blue"
	end if
%>
<tr><td align=center height=24 class=forumrow><input type="checkbox" name=userid value="<%=rsFtp("id")%>"></td>
    <td align=center height=24 class=forumrow><a href=?action=edit&ID=<%=rsFtp("id")%>><%=rsFtp("ftpname")%></a></td>
	<td align=center class=forumrow><a href='admin_bbsftpusercfg.asp?action=edit&ID=<%=iid%>&username=<%=rsFtp("linkname")%>'><font color=<%=clr%>><%=rsFtp("linkname")%></font></a></td>
	<td align=center  class=forumrow><%=rsFtp("FTP")%></td>
	<td align=center  class=forumrow><%=rsFtp("Value")%></td>
	
	
	<td align=center  class=forumrow><%=rsFtp("UserName")%></td>
	<td align=center  class=forumrow>[<a href='?action=editlog&ID=<%=rsFtp("ID")%>'>权限</a>][<a href='?action=delete&ID=<%=rsFtp("ID")%>'>删除</a>]</td>	
	</tr>
<%	
		rsFtp.MoveNext
	wend
end if    
response.write "<tr><td colspan=7 align='center' height=24 class=forumRowHighlight><a href='?action=edit&ID=-1'><font color=red>添加新的Ftp配置</font></a></td></tr>"
response.write "</form></table>"

end sub

sub Edit_Ftp()
dim rsFTP,bNewFtp,sAction,s
dim FtpInfo,FtpIP,Value,SellTimes,UserName,Password,LinkName,MaxUsers,MaxPerIP,DownSpeed
dim ftpurl,ftpmem
bNewFtp = 0
if request("ID")>0 then
	set rsFTP = server.createobject("adodb.recordset")
	rsFtp.Open "select * from FTPConfig where ID=" & request("ID"), LOGconn, 1, 3
	if not (rsFtp.bof and rsFtp.eof) then
		FtpInfo = rsFtp("FTPNAME")
		FtpIP = rsFtp("FTP")
		ftpmem = rsftp("FTPAnnounce")
		ftpurl = rsftp("FTPURL")
		Value = rsFtp("Value")
		SellTimes = rsFtp("BuyCount")
		UserName = rsFtp("UserName")
		Password = rsFtp("Password")
		LinkName = rsFtp("LinkName")
		MaxUsers = rsFtp("MaxUser")
		MaxPerIP = rsFtp("NumPerIP") 
		DownSpeed = rsFtp("UserSpeed")
	else
		bNewFtp = 1
	end if
else
	bNewFtp = 1
end if
if bNewFtp=1 then
	FtpInfo = ""
	FtpIp = "127.0.0.1:21"
	ftpmem = ""
	ftpurl = ""
	Value = 50
	SellTimes = 0
	UserName = "bbsftp"
	Password = "bbsftp"
	LinkName = ""
	MaxUsers = 20
	MaxPerIP = 1
	DownSpeed = 150
	sAction = "add"
	s = "添加新的Ftp配置"
else
	sAction = "update"
	s = "修改Ftp配置"
end if
%>

<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<form method="POST" name="editftp" action="?action=<%=sAction%>">
<tr><th colspan=6 height=23 align=center><%=s%></th></tr>
<input type="hidden" name="ID" value="<%=request("ID")%>">  
<tr>
<td width=20% class=forumrow>FTP名称</td>
<td width=80% class=forumrow colspan=5><input size=25 name="FtpInfo" type=text value="<%=FtpInfo%>"><%=MustStr%></td>
</tr>
<tr>
<td width=20% class=forumrow>FTP说明</td>
<td width=80% class=forumrow colspan=5><textarea name=ftpmem rows=5 cols=40 wrap=virtual><%=ftpmem%></textarea></td>
</tr>
<tr>
<td width=20% class=forumrow>地址端口(IP:Port)</td>
<td width=80% class=forumrow colspan=5><input size=25 name="FtpIP" type=text value="<%=FtpIP%>"><%=MustStr%></td>
</tr>
<tr>
<td width=20% class=forumrow>FTP访问地址</td>
<td width=80% class=forumrow colspan=5><input size=25 name=Ftpurl type=text value="<%=ftpurl%>"> [给用户看到的地址]</td>
</tr>
<tr>
<td width=20% class=forumrow>价格</td>
<td width=80% class=forumrow colspan=5><input size=25 name="Value" type=text value="<%=Value%>"><%=MustStr%>单位/<%=BuyUnit%></td>
</tr><tr>
<td width=20% class=forumrow>密码卖出次数</td>
<td width=80% class=forumrow colspan=5><input size=25 name="SellTimes" type=text value="<%=SellTimes%>"></td>
</tr>  
 
<tr>
<td width=20% class=forumrow>服务器角色</td>
<td width=80% class=forumrow colspan=5><input size=25 name="LinkName" type=text value="<%=LinkName%>"><%=MustStr%><%if bNewFtp<>1 and CheckLinkName(LinkName)<1 then%> <a href='admin_bbsftpusercfg.asp?action=edit&ID=0&username=<%=LinkName%>'><font color=red>该角色尚未配置,点此配置</font></a> <%else%>公共帐号使用这个角色,流量帐号缺省使用这个角色.<%end if%></td>
</tr>   

<tr><th colspan=6 height=23 align=center>公共帐号设置</th></tr>

  
    
    <tr >
      <td width="20%" class=forumrow>公共帐号用户名</td>
      <td width="80%" class=forumrow><input type="text" name="UserName" size="20" value="<%=UserName%>"><font color=red>请不要和ServU中的用户同名</font></td>
    </tr>
   <tr >
      <td width="20%" class=forumrow>公共帐号密码</td>
      <td width="80%" class=forumrow><input type="text" name="Password" size="20" value="<%=Password%>"></td>
    </tr> 
    <tr>
      <td width="20%" class=forumrow>Max no.</td>  
      <td width="80%" class=forumrow><input type="text" name="MaxUsers" size="20" value="<%=MaxUsers%>">公共帐号最大登录数,会覆盖角色中的设定</td>
    </tr>
    <tr>
      <td width="20%" class=forumrow>每IP登录数</td>
      <td width="80%" class=forumrow><input type="text" name="MaxPerIP" size="20" value="<%=MaxPerIP%>">公共帐号每IP最大登录数,会覆盖角色中的设定</td>
    </tr>
    <tr>
      <td width="20%" class=forumrow>下载速度</td>
      <td width="80%" class=forumrow><input type="text" name="DownSpeed" size="20" value="<%=DownSpeed%>">公共帐号下载的速度上限 kbs if>0 它会覆盖(用户角色)中的设置</td>  
    </tr>
    
<tr>
<td colspan=6 align=center height=25 class="forumRowHighlight">
<input type=reset value="重置"><input type=submit value="提交修改">
</td></tr>  </form>  
  </table>
  


<%
end sub

sub EditLog_Ftp()
dim rsFTP,s
dim FtpIP
if isnumeric(request("ID")) and request("ID")> 0 then
	set rsFTP = server.createobject("adodb.recordset")
	rsFtp.Open "select * from FTPConfig where ID=" & request("ID"), LOGconn, 1, 3
	if not (rsFtp.bof and rsFtp.eof) then		
		FtpIP = rsFtp("FTP")		
	else
		bbsftp_error("错误的Ftp ID!")
		exit sub
	end if
else
	bbsftp_error("错误的Ftp ID!")
	exit sub
end if
rsFtp.close
rsFtp.open "Select * from FtpLog_FtpStatistic where Ftp='" & ftpip & "'"
if rsFtp.eof then
	rsftp.addnew
	
	rsftp("StartTime") = Now
	rsftp("EndTime") = Now
	rsftp("UpLoadFileSize") = 0
	rsftp("UpLoadFileCount") = 0
	rsftp("DownLoadFileSize") = 0
	rsftp("DownLoadFileCount") = 0
	rsftp("LoginTimes") = 0
	rsftp("ConnectionTimes") = 0
	
	rsftp("SelleGB") = 0
	rsftp("WebClick") = 0
	rsftp("Seller") = "-"
	rsftp("FTP") = ftpip
	rsftp.update
end if
%>

<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<form method="POST" name="editftp" action="?action=updatelog">
<tr><th colspan=6 height=23 align=center>编辑Ftp统计信息和权限<%=ftpip%></th></tr>
<input type="hidden" name="ftpip" value="<%=ftpip%>">  
<tr>
<td width=20% class=forumrow>上架日期</td>
<td width=80% class=forumrow colspan=5><input size=25 name="starttime" type=text value="<%=rsftp("starttime")%>"></td>
</tr>
<tr>
<td width=20% class=forumrow>上传数据</td>
<td width=80% class=forumrow colspan=5><input size=25 name="uploadfilesize" type=text value="<%=rsftp("uploadfilesize")%>">千字节</td>
</tr><tr>
<td width=20% class=forumrow>上传文件</td>
<td width=80% class=forumrow colspan=5><input size=25 name="uploadfilecount" type=text value="<%=rsftp("uploadfilecount")%>">个</td>
</tr><tr>
<td width=20% class=forumrow>下载数据</td>
<td width=80% class=forumrow colspan=5><input size=25 name="downloadfilesize" type=text value="<%=rsftp("downloadfilesize")%>">千字节</td>
</tr>  
 
<tr>
<td width=20% class=forumrow>下载文件</td>
<td width=80% class=forumrow colspan=5><input size=25 name="downloadfilecount" type=text value="<%=rsftp("downloadfilecount")%>">个</td>
</tr>   
   
    <tr >
      <td width="20%" class=forumrow>用户登录</td>
      <td width="80%" class=forumrow><input type="text" name="logintimes" size="20" value="<%=rsftp("logintimes")%>">次</td>
    </tr>
   <tr >
      <td width="20%" class=forumrow>处理连接</td>
      <td width="80%" class=forumrow><input type="text" name="connectiontimes" size="20" value="<%=rsftp("ConnectionTimes")%>"></td>
    </tr> 
    <tr>
      <td width="20%" class=forumrow>售出流量</td>  
      <td width="80%" class=forumrow><input type="text" name="selleGB" size="20" value="<%=rsftp("selleGB")%>">GB</td>
    </tr>
    <tr>
      <td width="20%" class=forumrow>Web点击</td>
      <td width="80%" class=forumrow><input type="text" name="WebClick" size="20" value="<%=rsftp("WebClick")%>">次</td>
    </tr>
    <tr>
      <td width="20%" class=forumrow>卖方</td>
      <td width="80%" class=forumrow><input type="text" name="Seller" size="20" value="<%=rsftp("Seller")%>"></td>  
    </tr>
    <tr>
      <td width="20%" class=forumrow>服务器状态</td>
      <td width="80%" class=forumrow><input type="text" name="State" size="20" value="<%=rsftp("State")%>"></td>  
    </tr>
<tr>
<td colspan=6 align=center height=25 class="forumRowHighlight">
<input type=reset value="重置"><input type=submit value="提交修改">
</td></tr>  </form>  
  </table>
  


<%
rsftp.close
set rsftp = nothing
end sub

sub Add_Ftp()
dim rsFTP,mrs,ftpurl
dim FtpInfo,FtpIP,Value,SellTimes,UserName,Password,LinkName,MaxUsers,MaxPerIP,DownSpeed
FtpInfo = request("FtpInfo")
FtpIP = request("FtpIP")
Value = request("Value")
SellTimes = request("SellTimes")
UserName = request("UserName")
Password = request("Password")
LinkName = request("LinkName")
MaxUsers = request("MaxUsers")
MaxPerIP = request("MaxPerIP")
DownSpeed = request("DownSpeed")
ftpurl = request("ftpurl")
'检查数据的有效性。。。。
'
if ftpurl="" then ftpurl = ftpip

set rsFTP = server.createobject("adodb.recordset")
rsFtp.Open "select * from FTPConfig", LOGconn, 1, 3
rsFtp.AddNew
rsFTP("FTPAnnounce") = Request("ftpmem")
rsFTP("FTPURL") = ftpurl
rsFtp("FTPNAME") = FtpInfo
    rsFtp("FTP") = FtpIP
    rsFtp("Value") = Value
    rsFtp("BuyCount") = SellTimes
    rsFtp("UserName") = UserName
    rsFtp("Password") = Password
    rsFtp("LinkName") = LinkName
    rsFtp("MaxUser") = MaxUsers
    rsFtp("NumPerIP") = MaxPerIP
    rsFtp("UserSpeed") = DownSpeed

rsFtp("LastUpdatePassWord") = Now
rsFtp("ExpireTime") = DateAdd("h", pwUpTime, Now)
rsFtp("Type") = 0
rsFtp.Update
rsFtp.Close
set rsFtp = nothing

set mrs=server.createobject("adodb.recordset")
mrs.open  "select * from FtpLog_FtpStatistic where FTP='"&ftpip&"'",logconn,1,3
if mrs.eof then
	mrs.addnew
	
	mrs("StartTime") = Now
	mrs("EndTime") = Now
	mrs("UpLoadFileSize") = 0
	mrs("UpLoadFileCount") = 0
	mrs("DownLoadFileSize") = 0
	mrs("DownLoadFileCount") = 0
	mrs("LoginTimes") = 0
	mrs("ConnectionTimes") = 0
	
	mrs("SelleGB") = 0
	mrs("WebClick") = 0
	mrs("Seller") = "-"
	mrs("FTP") = ftpip
	mrs("State") = "运行"
	mrs.update
end if
mrs.close
set mrs = nothing
bbsftp_suc("<p align='enter'>OK,添加成功!</p>")

end sub

sub Update_Ftp()
dim rsFTP
dim FtpInfo,FtpIP,Value,SellTimes,UserName,Password,LinkName,MaxUsers,MaxPerIP,DownSpeed,ftpurl
ftpurl = request("ftpurl")
FtpInfo = request("FtpInfo")
FtpIP = request("FtpIP")
Value = request("Value")
SellTimes = request("SellTimes")
UserName = request("UserName")
Password = request("Password")
LinkName = request("LinkName")
MaxUsers = request("MaxUsers")
MaxPerIP = request("MaxPerIP")
DownSpeed = request("DownSpeed")
'检查数据的有效性。。。。
'
if ftpurl="" then ftpurl = ftpip

set rsFTP = server.createobject("adodb.recordset")
rsFtp.Open "select * from FTPConfig where ID=" & request("ID"), LOGconn, 1, 3

if rsFtp.bof and rsFtp.eof then
bbsftp_error("<p align='enter'><font color=red>更新失败!ID错误;</font></p>")

exit sub
end if

rsFtp.MoveFirst
rsFTP("FTPAnnounce") = Request("ftpmem")
rsFTP("FTPURL") = ftpurl
rsFtp("FTPNAME") = FtpInfo
    rsFtp("FTP") = FtpIP
    rsFtp("Value") = Value
    rsFtp("BuyCount") = SellTimes
    rsFtp("UserName") = UserName
    rsFtp("Password") = Password
    rsFtp("LinkName") = LinkName
    rsFtp("MaxUser") = MaxUsers
    rsFtp("NumPerIP") = MaxPerIP
    rsFtp("UserSpeed") = DownSpeed

rsFtp("LastUpdatePassWord") = Now
rsFtp("ExpireTime") = DateAdd("d", 3, Now)
rsFtp.Update
rsFtp.Close
set rsFtp = nothing
bbsftp_suc("<p align='enter'>OK,更新成功!</p>")
end sub

sub UpdateLog_ftp()
dim rsftp,ftpip
ftpip = request("ftpip")
set rsFTP = server.createobject("adodb.recordset")
rsFtp.open "Select * from FtpLog_FtpStatistic where Ftp='" & ftpip & "'",logconn,1,3
if not rsFtp.eof then
	
	
	rsftp("StartTime") = request("starttime")
	
	rsftp("UpLoadFileSize") = request("uploadfilesize")
	rsftp("UpLoadFileCount") = request("uploadfilecount")
	rsftp("DownLoadFileSize") = request("downloadfilesize")
	rsftp("DownLoadFileCount") = request("downloadfilecount")
	rsftp("LoginTimes") = request("logintimes")
	rsftp("ConnectionTimes") = request("connectiontimes")
	
	rsftp("SelleGB") = request("sellegb")
	rsftp("WebClick") = request("webclick")
	rsftp("Seller") = request("seller")
	rsftp("State") = request("State")
	rsftp.update
	bbsftp_suc("OK,更新成功!")
else
	bbsftp_error("错误,没有找到相关ftp的记录。")	
end if
rsftp.close
set rsftp = nothing
end sub

sub deleteftp()
LOGconn.execute "delete from FTPConfig where ID=" & request("ID")
call list_Ftp
end sub
%>

⌨️ 快捷键说明

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