用ASP创建MDaemon用户的代码

2018-09-06 11:06

阅读:444

  <%@Language=VBScript%>
<!--METADATATYPE=TypeLibUUID={01E88D14-F479-4CA5-9CA8-EBD2EED74C83}-->
<HTML>
<BODY>
<H1align=center>在线注册演示</H1>
<%
DimsMessage
IfRequest.Form(cmdAddUser)<>Then

DimoMDUser
DimoMDUserInfo
DimnResult
DimsFullName
DimsUserName
DimsPassword

sFullName=Request.Form(txtFullName)
sUserName=Request.Form(txtUserName)
sPassword=Request.Form(txtPassword)
sDomain=Request.Form(txtDomain)

SetoMDUser=Server.CreateObject(MDUserCOM.MDUser)
SetoMDUserInfo=Server.CreateObject(MDUserCOM.MDUserInfo)
IfoMDUser.LoadUserDll()=TrueThen

oMDUserInfo.FullName=sFullName
oMDUserInfo.MailBox=sUserName
oMDUserInfo.Password=sPassword
oMDUserInfo.Domain=sDomain
oMDUser.FilterUserInfo(oMDUserInfo)
nResult=oMDUser.AddUser(oMDUserInfo)

SelectCasenResult
CaseMDDLLERR_NOERROR
sMessage=用户注册成功!
CaseMDDLLERR_USEREXISTS
sMessage=用户名:&sUserName&已存在!注册失败!
caseElse
sMessage=注册用户失败!错误代码:&nResult
EndSelect

oMDUser.FreeUserDll
Else
sMessage=错误:不能加载DLL文件
EndIf
SetoMDUser=Nothing
SetoMDUserInfo=Nothing
EndIf
%>

<P>新用户注册</P>
<FORMACTION=adduser.aspMETHOD=postID=Form1>
<TABLEID=Table1>
<TR><TD>域名:</TD><TD><INPUTSIZE=50NAME=txtDomainID=Text1value=system.mailreadonly></TD></TR>
<TR><TD>全名:</TD><TD><INPUTSIZE=50NAME=txtFullNameID=Text2></TD></TR>
<TR><TD>登录名:</TD><TD><INPUTSIZE=25NAME=txtUserNameID=Text3></TD></TR>
<TR><TD>口令:</TD><TD><INPUTTYPE=passwordSIZE=25NAME=txtPasswordID=Password1></TD></TR>
<TR><TD></TD><TD><INPUTTYPE=submitvalue=注册新用户NAME=cmdAddUserID=Submit1></TD></TR>
</TABLE>
</FORM>
<%
Response.Write(sMessage&<BR>)
%>
</BODY>
</HTML>


评论


亲,登录后才可以留言!