%
'Wihm Serv-u FTP Güncelleme Yaması.
'Oguzhan YILMAZ
'oguzhan@websahibi.com
Server.ScriptTimeOut = 100000
Sub QuotaGuncelle()
set fs=Server.CreateObject("Scripting.FileSystemObject")
set GetUser = winhmconn.execute("SELECT user_name,ftp_quotanow,ftp_homedir FROM users_properties WHERE user_type = 1")
do while not GetUser.EOF
FizikselDizin = GetUser("ftp_homedir")
if fs.FolderExists(FizikselDizin) = true Then
set fo = fs.GetFolder(FizikselDizin)
FtpQuotaNow = fo.Size
winhmconn.execute("UPDATE users_properties SET ftp_quotanow='"& FtpQuotaNow &"' WHERE user_name='"& GetUser("user_name") &"'")
set fo = nothing
Response.Write GetUser("ftp_homedir") &"
"
End if
GetUser.MoveNext
Loop
Set GetUser = nothing
set fs=nothing
End Sub
Sub Ftpguncelle()
Set fsho = CreateObject("Scripting.FileSystemObject")
Set df = fsho.OpenTextFile("C:\Serv-U\SERV-U.INI", 1)
ReversUpdate = "Off"
if ReversUpdate = "On" Then
Do While df.AtEndOfStream <> True
s = df.readline
IF LEFT(s,6) = "[USER=" then
rakam=len(s)
userstring = MID(s,7,rakam-7)
ekle=1
END IF
IF LEFT(s,16) = "QuotaMaxCurrent=" then
rakam=len(s)
nerede=instr(s,",")
if nerede=0 then
currentstring = "0"
else
currentstring = MID(s,(nerede+1),(rakam-nerede))
end if
winhmconn.execute("UPDATE users_properties SET ftp_quotanow='"¤tstring&"' WHERE user_name='"&userstring&"'")
ekle=0
END IF
Loop
End if '// ReversUpdate Son.
df.close
Set ws = fsho.OpenTextFile("C:\Serv-U\SERV-U.INI", 2,true)
Set XS = winhmconn.execute("SELECT ftp_other_data FROM ftp_other order by ftp_other_id")
Do While Not XS.EOF
ws.writeline(XS(0))
XS.MoveNext
Loop
Set RS = winhmconn.execute("SELECT * FROM users_properties WHERE (user_type='1' or user_type='4' or user_type='2') order by user_id")
Do While Not RS.EOF
IF isnull(RS("user_name")) THEN
ELSE
ws.writeline("[USER="&RS("user_name")&"]")
END IF
IF isnull(RS("ftp_password")) THEN
ELSE
ws.writeline("Password="&RS("ftp_password"))
END IF
IF isnull(RS("ftp_homedir")) THEN
ELSE
ws.writeline("HomeDir="&RS("ftp_homedir"))
END IF
ws.writeline("RelPaths=YES")
ws.writeline("MaxUsersLoginPerIP=3")
ws.writeline("ChangePassword=NO")
ws.writeline("SpeedLimit=262144")
IF isnull(RS("ftp_maxnrusers")) THEN
ELSE
ws.writeline("MaxNrUsers="&RS("ftp_maxnrusers"))
END IF
ws.writeline("QuotaEnable=YES")
IF isnull(RS("ftp_quotamaxcurrent")) THEN
ELSE
ws.writeline("QuotaMaxCurrent="&RS("ftp_quotamaxcurrent") * 1024 &","&RS("ftp_quotanow"))
Response.Write RS("ftp_quotamaxcurrent")&","&RS("ftp_quotanow") &"
"
END IF
ordn=1
IF RS("user_type")=2 THEN
IF isnull(RS("ftp_homedir")) THEN
ELSE
ws.writeline("Access"&cstr(ordn)&"="&RS("ftp_homedir")&",RL")
END IF
ELSE
IF isnull(RS("ftp_homedir")) THEN
ELSE
ws.writeline("Access"&cstr(ordn)&"="&RS("ftp_homedir")&",RWAMCDLP")
END IF
END IF
IF RS("user_type")=2 THEN
Set TS = winhmconn.execute("SELECT ftp_homedir FROM users_properties WHERE user_owner_id='"&RS("user_id")&"' order by user_id")
IF TS.EOF THEN
ELSE
DO WHILE NOT TS.EOF
ordn=ordn+1
ws.writeline("Access"&cstr(ordn)&"="&TS("ftp_homedir")&",RWAMCDLP")
TS.MoveNext
Loop
END IF
ELSE
END IF
RS.MoveNext
ordn=0
Loop
End Sub
Call QuotaGuncelle()
Call FtpGuncelle()
Response.Write "OK"
%>