首 页文章中心软件下载繁體中文
设为首页
加入收藏
联系我们
您当前的位置:一起玩电脑 -> 源码教程 -> ASP学习 -> 文章内容
栏目导航
· ASP学习
热门文章
· 完美卸载OFFICE2003
· 让计算机自动开机
· 减少Win XP占用系统资..
· 判断QQ好友是否在线
· 一条命令搞定还原精灵..
· Boot.ini解析
· 重装操作系统的20条原..
· 简单几招让你的电脑不..
· 被删除文件恢复全攻略..
· 智能ABC输入法超酷技巧..
· 毒杀不死的原因分析及..
· pdg格式转换为pdf格式..
创建ASP组件修改《SERV-U》FTP 的密码
作者:不详  来源:本站整理  发布时间:2006-12-21 10:02:41  发布人:ahlqhbc

减小字体 增大字体

新建一《SERV-U》FTP服务器,在ASP中修改指定帐户的密码,写了一ASP组件来修改《SERV—U》  FTP密码。
启动《Vb6.0》,选择新建ActiveX DLL,更改工程属性中的工程名称为“Ftpcommand”,将CLASS名改为XJNFTP,源程序如下:

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


‘修改FTP密码主程序
Public Function getStr() As String
hOpen = 0
    hConnection = 0
    Dim nFlag As Long
    Dim strCmd As String
nFlag = INTERNET_FLAG_PASSIVE
‘建立FTP修改密码命令字符串
strCmd = "SITE PSWD " & oldPASSWORD & Space(1) & newPASSWORD
‘建立internet连接
hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
If hOpen = 0 Then getStr = "不能打开连接。..."
If hOpen <> 0 Then
‘与FTP服务器建立连接
  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 = "密码修改成功!..."
         Else
         getStr = "密码修改失败!..."
       End If
    Else
       getStr = "无法登录至FTP服务器,请检查帐户名或密码是否正确。"
   End If
[] [返回上一页] [打 印] [收 藏]
上一篇文章:使用ASP重启服务器
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论…]
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图
皖ICP备07500284号