<!--#include file="md5.asp"--> <% if Request.QueryString("action")="true" then user=Request.Form("user") password=Request.Form("password") password2=Request.Form("password2") if password<>password2 then Response.Write("两次密码不一致") Response.end end if tmp=rnd_num(1,2) password=lcase(tmp)&UCASE(md5(tmp&password)) '省略判断是否存在用户名及插入数据库 '创建文件夹 dir="G:\11\regftp\"&user set fso=Server.CreateObject("Scripting.FileSystemObject") set CreDir=fso.CreateFolder(dir) set CreDir=nothing set fso=nothing path="D:\Program Files\Serv-U" ininame="ServUDaemon.ini" CreateFtp path,ininame,user,password,dir,"600" end if%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head>
<body> <form name="form1" method="post" action="?action=true"> <p>用户名: <input name="user" type="text" id="user"> </p> <p>密码: <input name="password" type="password" id="password"> </p> <p>密码: <input name="password2" type="password" id="password2"> <input type="submit" name="Submit" value="提交"> </p> <p> </p> </form> </body> </html> <% function CreateFtp(Inipath,Ininame,user,password,dir,outtime) set fso=Server.CreateObject("Scripting.FileSystemObject") if fso.fileExists(Inipath&"\"&Ininame)=false then CreateFtp="ini文件不存在" exit function else set objfso=fso.OpenTextFile(Inipath&"\"&Ininame,1,false) set crefso=fso.CreateTextFile(Inipath&"\"&Ininame&".tmp") addedUserList = false do while not objfso.AtEndOfStream str=objfso.ReadLine if instr(str,"User")>0 then i=i+1 end if if instr(str,"[USER=")>0 and not addedUserList then i=i+1 crefso.WriteLine("User"&i&"="&user&"|1|0") addedUserList = true end if crefso.WriteLine str loop objfso.close set objfso=nothing crefso.WriteLine("[USER="&user&"|1]") crefso.WriteLine("Password="&password) crefso.WriteLine("HomeDir="&dir) crefso.WriteLine("RelPaths=1") crefso.WriteLine("TimeOut="&outtime) crefso.WriteLine("Access1="&dir&"|RWLP") crefso.WriteLine("SKEYValues=") crefso.close set crefso=nothing '备份 set bak=fso.GetFile(Inipath&"\"&Ininame) bak.copy(Inipath&"\bak\"&Ininame&date&".bak") bak.delete set bak=nothing '把临时文件tmp改为正式ini文件 set bak=fso.GetFile(Inipath&"\"&Ininame&".tmp") bak.copy(Inipath&"\"&Ininame) bak.delete set bak=nothing end if set fso=nothing CreateFtp=true end function %>
|