用ASP创建MDaemon用户的代码
编程学习 2021-07-05 10:58www.dzhlxh.cn编程入门
<%@ Language=VBScript %>
<!-- METADATA TYPE="TypeLib" UUID="{01E88D14-F479-4CA5-9CA8-EBD2EED74C83}" -->
<HTML>
<BODY>
<H1 align=center>在线注册演示</H1>
<%
Dim sMessage
If Request.Form("cmdAddUser") <> "" Then
Dim oMDUser
Dim oMDUserInfo
Dim nResult
Dim sFullName
Dim sUserName
Dim sPassword
sFullName = Request.Form("txtFullName")
sUserName = Request.Form("txtUserName")
sPassword = Request.Form("txtPassword")
sDomain=Request.Form("txtDomain")
Set oMDUser = Server.CreateObject("MDUserCOM.MDUser")
Set oMDUserInfo = Server.CreateObject("MDUserCOM.MDUserInfo")
If oMDUser.LoadUserDll() = True Then
oMDUser.InitUserInfo(oMDUserInfo)
oMDUserInfo.FullName = sFullName
oMDUserInfo.MailBox = sUserName
oMDUserInfo.Password = sPassword
oMDUserInfo.Domain = sDomain
oMDUser.FilterUserInfo (oMDUserInfo)
nResult = oMDUser.AddUser (oMDUserInfo)
Select Case nResult
Case MDDLLERR_NOERROR
sMessage = "用户注册成功!"
Case MDDLLERR_USEREXISTS
sMessage = "用户名: '" & sUserName & "' 已存在!注册失败!"
case Else
sMessage = "注册用户失败 ! 错误代码:" & nResult
End Select
oMDUser.FreeUserDll
Else
sMessage = "错误: 不能加载DLL文件"
End If
Set oMDUser = Nothing
Set oMDUserInfo = Nothing
End If
%>
<P>新用户注册</P>
<FORM ACTION="adduser.asp" METHOD=post ID="Form1">
<TABLE ID="Table1">
<TR><TD>域名:</TD><TD><INPUT SIZE=50 NAME="txtDomain" ID="Text1" value="system.mail" readonly></TD></TR>
<TR><TD>全名:</TD><TD><INPUT SIZE=50 NAME="txtFullName" ID="Text2"></TD></TR>
<TR><TD>登录名:</TD><TD><INPUT SIZE=25 NAME="txtUserName" ID="Text3"></TD></TR>
<TR><TD>口令:</TD><TD><INPUT TYPE="password" SIZE=25 NAME="txtPassword" ID="Password1"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE="submit" value="注册新用户" NAME="cmdAddUser" ID="Submit1"></TD></TR>
</TABLE>
</FORM>
<%
Response.Write(sMessage & "<BR>")
%>
</BODY>
</HTML>
<!-- METADATA TYPE="TypeLib" UUID="{01E88D14-F479-4CA5-9CA8-EBD2EED74C83}" -->
<HTML>
<BODY>
<H1 align=center>在线注册演示</H1>
<%
Dim sMessage
If Request.Form("cmdAddUser") <> "" Then
Dim oMDUser
Dim oMDUserInfo
Dim nResult
Dim sFullName
Dim sUserName
Dim sPassword
sFullName = Request.Form("txtFullName")
sUserName = Request.Form("txtUserName")
sPassword = Request.Form("txtPassword")
sDomain=Request.Form("txtDomain")
Set oMDUser = Server.CreateObject("MDUserCOM.MDUser")
Set oMDUserInfo = Server.CreateObject("MDUserCOM.MDUserInfo")
If oMDUser.LoadUserDll() = True Then
oMDUser.InitUserInfo(oMDUserInfo)
oMDUserInfo.FullName = sFullName
oMDUserInfo.MailBox = sUserName
oMDUserInfo.Password = sPassword
oMDUserInfo.Domain = sDomain
oMDUser.FilterUserInfo (oMDUserInfo)
nResult = oMDUser.AddUser (oMDUserInfo)
Select Case nResult
Case MDDLLERR_NOERROR
sMessage = "用户注册成功!"
Case MDDLLERR_USEREXISTS
sMessage = "用户名: '" & sUserName & "' 已存在!注册失败!"
case Else
sMessage = "注册用户失败 ! 错误代码:" & nResult
End Select
oMDUser.FreeUserDll
Else
sMessage = "错误: 不能加载DLL文件"
End If
Set oMDUser = Nothing
Set oMDUserInfo = Nothing
End If
%>
<P>新用户注册</P>
<FORM ACTION="adduser.asp" METHOD=post ID="Form1">
<TABLE ID="Table1">
<TR><TD>域名:</TD><TD><INPUT SIZE=50 NAME="txtDomain" ID="Text1" value="system.mail" readonly></TD></TR>
<TR><TD>全名:</TD><TD><INPUT SIZE=50 NAME="txtFullName" ID="Text2"></TD></TR>
<TR><TD>登录名:</TD><TD><INPUT SIZE=25 NAME="txtUserName" ID="Text3"></TD></TR>
<TR><TD>口令:</TD><TD><INPUT TYPE="password" SIZE=25 NAME="txtPassword" ID="Password1"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE="submit" value="注册新用户" NAME="cmdAddUser" ID="Submit1"></TD></TR>
</TABLE>
</FORM>
<%
Response.Write(sMessage & "<BR>")
%>
</BODY>
</HTML>
上一篇:ASP使用FSO读取模板的代码
下一篇:asp中COM组件中如何连接数据库的代码