<%@ Language=VBScript %>
<%Option Explicit%>
<!-- #INCLUDE FILE = "../inc.asp" -->
<%
CheckAdminLogin()

Dim key, aRTs
Dim i
Dim aGroups(3)
For Each key In Request.Form
	Select Case Left(key,2)
		Case "GN"'数组第1项为GroupName
			If Request.Form(key) = Empty Then err("组名不能为空。")
			aGroups(1) = Request.Form(key)
		Case "RT"'数组第2项为Rights
			If IsEmpty(aGroups(2)) Then
				aGroups(2) = Right(key,Len(key)-2)
			Else
				aGroups(2) = aGroups(2) & "," & Right(key,Len(key)-2)
			End If
		Case "LV"'数组第一项为LeVel
			If Request.Form(key) = Empty Then err("等级不能为空。")
			If Not IsNumeric(Request.Form(key)) Then err("等级必须是数字。")
			aGroups(3) = CInt(Request.Form(key))
	End Select
Next
Dim oChat
Set oChat = Server.CreateObject("LSChat.ChatRooms")
oChat.Configure g_SiteName, g_SiteDomain, g_DBString, g_ErrFile, g_ScriptName

If Not oChat.addNewGroup(aGroups) Then
	Set oChat = Nothing
	err("在添加新组时，发生错误。请与<a href=""mailto:shooray@sina.com"">作者</a>联系。")
End If
Set oChat = Nothing

Dim sURL
sURL = "m_vgroups.asp"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
var dtTime = 3000;
function Redirect(){
	RedirectDIV.innerHTML = "您已经成功添加新组！<font color=\"red\"><b>" + dtTime/1000 + "</b></font> 秒钟之后，系统将自动为您转到“检阅组及权限”页面。";
	dtTime -= 1000;
	if(dtTime>=0)
		setTimeout("Redirect()", 1000, "javascript");
	else
		self.location = "<%=sURL%>";
}
//-->
</script>
<link rel="stylesheet" href="manager.css" type="text/css">
</head>
<body <%=g_BodyTag%>>
<div name="RedirectDIV" id="RedirectDIV" align="center"></div>
<script language="javascript">
<!--
Redirect();
//-->
</script>
</body>
</html>