<%@ 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>