serv-u| Create a new "Serv-u" FTP server, in the ASP to modify the specified account password, wrote an ASP component to modify the "Serv-u" ftp password.
Start "Vb6.0", select the new ActiveX DLL, change engineering properties in the project name "FtpCommand", the class name to Xjnftp, the source program is as follows:
Private Const scuseragent = "vb WinInet"
Private Const internet_open_type_preconfig = 0
Private Const internet_open_type_direct = 1
Private Const Internet_open_type_proxy = 3
Private Const internet_invalid_port_number = 0
Private Const ftp_transfer_type_binary = &h2
Private Const ftp_transfer_type_ascii = &h1
Private Const internet_flag_passive = &h8000000
Private Const internet_service_ftp = 1
Private Const Internet_service_gopher = 2
Private Const internet_service_http = 3
Private Declare Function internetopen Lib "Wininet.dll" Alias "Internetopena" _
(ByVal sagent As String, ByVal Laccesstype as Long, ByVal Sproxyname As String, _
ByVal Sproxybypass as String, ByVal lflags as long) as long
Private Declare Function ftpcommand Lib "Wininet.dll" Alias "Ftpcommanda" _
(ByVal hconnect as Long, ByVal fexpectresponse as Boolean, ByVal dwflags as Long, _
ByVal Lpszcommand as String, ByVal Lcontext as Long, phftpcommand as long) as Boolean
Private Declare Function internetconnect Lib "Wininet.dll" Alias "Internetconnecta" _
(ByVal hinternetsession as Long, ByVal sServerName as String, ByVal Nserverport as Integer, _
ByVal sUserName As String, ByVal Spassword as String, ByVal Lservice as Long, _
ByVal lflags as Long, ByVal Lcontext as long) as long
Private Hopen as Long
Private Hconnection as Long
Private Declare Function internetclosehandle Lib "Wininet.dll" _
(ByVal hInet as Long) As Integer
Private NewPassword as String
Private OldPassword as String
Private UserName as String
Private Urlstr as String
' Modify the FTP password main program
Public Function getstr () as String
Hopen = 0
hconnection = 0
Dim Nflag as Long
Dim Strcmd as String
Nflag = internet_flag_passive
' Create FTP Modify password command string
Strcmd = "SITE pswd" & OldPassword & Space (1) & NewPassword
' Establish an Internet connection
Hopen = InternetOpen (scuseragent, Internet_open_type_direct, vbNullString, vbNullString, 0)
If hopen = 0 Then getstr = "The connection cannot be opened. ..."
If hopen <> 0 Then
' Establish a connection to the FTP server
Hconnection = InternetConnect (Hopen, Urlstr, Nternet_invalid_port_number, _
UserName, OldPassword, Internet_service_ftp, Nflag, 0)
If hconnection <> 0 Then
Bret = FtpCommand (Hconnection, False, Ftp_transfer_type_ascii, Strcmd, 0, hfile)
If Bret Then
GETSTR = "Password modified successfully!..."
Else
GETSTR = "Password modification failed!..."
End If
Else
Getstr = "Unable to log on to the FTP server, please check that the account name or password is correct." "
End If
End If
' Disconnect Internet connection
If hconnection <> 0 Then internetclosehandle (hconnection)
' Disconnect the FTP server
If hopen <> 0 Then internetclosehandle (hopen)
End Function
' URL of incoming FTP server
Public Property Let URL (URL1 as String)
Urlstr = URL1
End Property
' Incoming FTP old password
Public Property Let OLDPSD (PSD as String)
OldPassword = PSD
End Property
' Incoming FTP new password
Public Property Let NEWPSD (Psd1 as String)
NewPassword = PSD1
End Property
' Incoming FTP account name
Public Property Let user (Psd2 as String)
UserName = PSD2
End Property
Compile into Ftpcommand.DLL, register the component on the ASP server, (VB6.0 autoenrollment in ASP server), call the component in ASP, the source program is as follows:
<%
' Accept the incoming account name
User=trim (Request.Form ("id"))
' Accept the incoming original password
Psw=trim (Request.Form ("password"))
' Accept incoming new password
Pswx=trim (Request.Form ("PASSWORDX"))
' Create an FTP component application instance
Dim obj
Set obj = Server.CreateObject ("Ftpcommand.xjnftp")
' Send an account name to the FTP component
Obj.user=user
' Transmit the original password to the FTP component
Obj.oldpsd=psw
' Send a new password to the FTP component
Obj.newpsd=pswx
' Send FTP Server domain name address (URL) to FTP component
Obj.url= "Ftp://ftp.luckybbs.com"
Rr=obj.getstr ()
Response.Write ("<meta Http-equiv=refresh content=3; Url=/main.asp> ")
Response.Write ("<p><center&