<%@ Language=VBScript %>
<%Option Explicit
Response.Buffer = True
%>
<!-- #INCLUDE FILE = "inc.asp" -->
<!-- #INCLUDE FILE = "config.asp" -->
<%
Dim sUserID, sPassword1, sPassword2, sNickName, bSex, bShowSex, iGUID
Dim dtBirthday, bShowAge, sEmail, sPortrait, sAboutMe

sUserID = Request.Form("UserID")
sPassword1 = Request.Form("Password1")
sPassword2 = Request.Form("Password2")
sNickName = Trim(Request.Form("NickName"))
bSex = Request.Form("Sex")
bShowSex = Request.Form("ShowSex")
dtBirthday = Request.Form("Birthday")
bShowAge = Request.Form("ShowAge")
sEmail = Trim(Request.Form("Email"))
sPortrait = Request.Form("Portrait")
sAboutMe = Request.Form("AboutMe")
If sUserID = Empty Then err("请<a href=""default.asp"">返回首页</a>登陆。")
If sNickName = "大家" Then err("非法昵称，请另选好名！")

Dim oChat
Set oChat = Server.CreateObject("LSChat.Users")
oChat.Configure g_SiteName, g_SiteDomain, g_DBString, g_ErrFile, g_ScriptName
Dim rst, rstChatUser
Set rst = oChat.GetUser(sUserID)
If Not rst.EOF Then
	err(sUserID & "已存在，请您选择其他用户名。")
Else
	Set rstChatUser = oChat.GetChatUserByNickName(sNickName)
	If Not rstChatUser.EOF Then
		rst.Close: Set rst = Nothing
		rstChatUser.Close: Set rstChatUser = Nothing
		err("已经有人使用了这个昵称，请重新选择。")
	Else
		rst.AddNew
		rst("USERID") = sUserID
		rst("PASSWORD") = sPassword1
		rst("FULLNAME") = sUserID
		rst("USERDIR") = sUserDir & "\" & sUserID
		rst("MAILADDR") = sUserID & "@" & sDomain
		rst("MAXSIZE") = iMaxSize
	    rst("MAXMSGS") = iMaxMsgs
		rst("FLAGS") = 128
	    rst("Type") = 0
		rst("NUMTRIES") = 0
	    rst("ATTEMPTTIME") = 0
		rst("NUMTIMESSUSP") = 0
		rst("LASTLOGIN") = 0
		rst("SPNDUSRACCT") = 0
		rst("ICALENBL") = 0
		rst("SPELLENBL") = -1
		rst("NUMSGSTNS") = 4
		rst("IWDEPTH") = -1
		rst("IWOPTIONS") = 0
		rst("SPELLCHKG") = -1
		rst("PRVWSIZE") = -1
		rst("DEFVIEW") = Null
		rst("TIMEZONE") = Null
		rst("STRTDAY") = -1
		rst("DEFCALNM") = Null
		rst("ENTRYGRNL") = -1
	    rst("STARTTIME") = -1
		rst("ENDTIME") = -1
		rst("MAXEVNTDISP") = -1
		rst("MAXTSKDISP") = -1
		rst("MAXNOTEDISP") = -1
		rst("MAXDLYRCURCNT") = -1
		rst("MAXWKLYRCURCNT") = -1
		rst("MAXMONRCURCNT") = -1
		rst("MAXYRLYRCURCNT") = -1
		rst("DISPCMPLTDTSKS") = -1
		rst("HOURSCLOCK") = -1
		rst("MAXSRCHRESPPG") = -1
		rst("MAXEVENTTITLELEN") = -1
		rst("MAXTASKTITLELEN") = -1
		rst("CONFIRMONDELETE") = -1
		rst("NUMNOTIFY") = 0
		rst("LASTNOTIFY") = 0
		rst.Update
		iGUID = rst("GUID")
		
		rst.Close
		
		rstChatUser.AddNew
		rstChatUser("NickName") = sNickName
		rstChatUser("GUID") = iGUID
		rstChatUser("Sex") = bSex
		rstChatUser("ShowSex") = bShowSex
		rstChatUser("Birthday") = dtBirthday
		rstChatUser("ShowAge") = bShowAge
		rstChatUser("Email") = sEmail
		rstChatUser("Portrait") = sPortrait
		
		rstChatUser("ChatGroup") = "Users"
		rstChatUser("State") = 1
		rstChatUser("LastLogin") = Now()
		rstChatUser("FreeTime") = Now()
		rstChatUser("Logins") = 0
		rstChatUser("ChatMinutes") = 0
		rstChatUser("ChatWords") = 0
		rstChatUser("ChatMessages") = 0
		rstChatUser("AboutMe") = sAboutMe
		rstChatUser.Update
		rstChatUser.Close
		Set rstChatUser = Nothing
	End If
End If

Set rst = Nothing
Set oChat = Nothing
Response.Cookies("GUID") = Empty
Response.Cookies("USERID") = Empty
Response.Cookies("PASSWORD") = Empty
Session.Abandon
%>
<html>
<head>
<script src="inc.js" language="javascript"></script>
<script>document.write("<title>"+Title+"</title>");</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="common.css">
</head>
<body <%=g_BodyTag%>>
<!-- #INCLUDE File = "top.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td align="left">
    恭喜，您已经注册成功，您的GUID为<%=iGUID%>。请<a href="default.asp">返回</a>进入聊天室。
    </td>
  </tr>
</table>
<br>
<!-- #INCLUDE File = "bottom.asp" -->
</body>
</html>