asp代码实现在线实时开通FTP[转载]

<% Dim fso, f1, ts, s, input(),item,counter,i,n,ii,username1,sp
Set fso=CreateObject("Scripting.FileSystemObject")
'application("path")即serv-u的安装路径
Set ts=fso.OpenTextFile(application("path"),1, False) '打开ini文件
counter = 0 '行数
i=0
n=0 '用户数初始值为0
do while not ts.AtEndOfStream
thisline = ts.readline
Redim preserve input(counter)
input(counter) = thisline
if LCase(left(input(counter),4))=LCase("user") then
sp=split(input(counter),"|")
username1=sp(0)
username1=right(username1,(len(username1)-instr((username1),"=")))
if LCase(username1)=LCase(username) then   '判断用户名是否存在
Response.Write "用户名已经存在!"
Response.end
end if
if i=0 then
i=counter   '记录"user="在ini文件中的位置
end if
n=n+1 '统计用户数
end if

counter = counter + 1
loop
ts.Close

Set f1 = fso.CreateTextFile(application("path"), 1,False)
ii=0
for each item in input
if ii=(i+n) then
f1.WriteLine "user"&(n+1)&"="&username&"|1|0"
end if
f1.WriteLine item '将读出的
ii=ii+1
next

f1.WriteLine "[USER="&username&"|1]" '用户名
f1.WriteLine "Password="&userpass '密码
f1.WriteLine "HomeDir="&homepath&username '主目录路径
f1.WriteLine "RelPaths=1"
f1.WriteLine "AlwaysAllowLogin=1"
f1.WriteLine "ChangePassword=1"
f1.WriteLine "SpeedLimitUp=204800"
f1.WriteLine "SpeedLimitDown=204800"
f1.WriteLine "DiskQuota=1|20480000|0" '空间大小
f1.WriteLine "TimeOut=600"
f1.WriteLine "Access1="&homepath&username&"|RWAMLCDP" '目录读写权限

application.unlock 解除application锁定
Response.Redirect "page.asp" '发送成功页面
response.end
%> 
 http://hi.baidu.com/lin617/blog/item/880a20df1a03fa126227987c.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值