<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0804") then Call ReturnError()
%>
<html>
<head>
<link href="../Inc/ModeWindow.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>会员组添加</title>
</head>
<script language="JavaScript" src="../JS/PublicJS.js"></script>
<body leftmargin="0" topmargin="0">
<form action="" name="UserGroupForm" method="post">
  <table width="100%" border="0" cellspacing="5" cellpadding="0">
    <tr> 
      <td width="6%" height="5">&nbsp;</td>
      <td width="20%" height="5">&nbsp;</td>
      <td width="74%" height="5">&nbsp;</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>组&nbsp;&nbsp;&nbsp;&nbsp;名</td>
      <td><input name="Name" type="text" id="Name" style="width:90%" title="会员组名称,长度不能超过25个中文字符" value="<%=Request("Name")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>权限级别</td>
      <td><input name="PopLevel" onBlur="CheckNumber(this,'权限级别');" type="text" id="PopLevel" style="width:90%" title="输入会员权限级别,数值越小,权限越大,范围:10-32767,用于设置新闻浏览权限" value="<%=Request("PopLevel")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td>初始积分</td>
      <td><input name="Point" type="text" id="Point" style="width:90%" title="会员的初始积分数,分数越大,权限越高,多用于新闻浏览以外的其它会员动作" value="<%=Request("Point")%>"></td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td valign="top">说&nbsp;&nbsp;&nbsp;&nbsp;明</td>
      <td><textarea name="Comment" id="Comment" style="width:90%" title="对会员组的说明文字,方便后台管理"><%=Request("Comment")%></textarea></td>
    </tr>
    <tr> 
      <td height="5">&nbsp;</td>
      <td height="5">&nbsp;</td>
      <td height="5">&nbsp;</td>
    </tr>
    <tr> 
      <td colspan="3"><div align="center"> 
          <input type="submit" name="Submit" value=" 添 加 ">
          <input name="action" type="hidden" id="action" value="add">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="button" name="Submit2" value=" 取 消 " onclick="window.close();">
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
<%
 If Request.Form("action")="add" then
    Dim UserGroupObj,UserGroupSql
	Set UserGroupObj=server.createobject("adodb.recordset")
		UserGroupSql="select * from MemGroup"
		UserGroupObj.open UserGroupSql,Conn,3,3
		UserGroupObj.addnew 
		UserGroupObj("GroupID") = GetRandomID18
		If Request.Form("Name") <> "" then
			UserGroupObj("Name") = Replace(Replace(Request.Form("Name"),"""",""),"'","")
		Else
			Response.Write("<script>alert(""请输入会员组名"");</script>")
			Response.End
		End If
		If  Request.Form("PopLevel")<>"" then
		    If Isnumeric(Request.Form("PopLevel")) and Cint(Request.Form("PopLevel"))>10 and Cint(Request.Form("PopLevel"))<32767 then
				UserGroupObj("PopLevel") = Cint(Request.Form("PopLevel"))
			Else
				Response.Write("<script>alert(""会员组级别必须为数字类型,且不能小于10大于32767"");</script>")
				Response.End
			End If
		Else
			Response.Write("<script>alert(""会员组级别必须为数字类型,且不能小于10大于32767"");</script>")
			Response.End
		End If
		If Request.Form("Comment")<>"" then
			UserGroupObj("Comment") = Request.Form("Comment")
		End If
		UserGroupObj("SysTypeTF") = "0"
		If Isnumeric(Request.Form("Point")) then
			UserGroupObj("Point") = Request.Form("Point")
		Else
			Response.Write("<script>alert(""会员组级别必须为数字类型"");</script>")
			Response.End
		End If
		UserGroupObj("AddTime") = now()
		UserGroupObj.Update
		UserGroupObj.Close
		Set UserGroupObj = Nothing
		Response.Write("<script>alert(""会员组添加成功"");dialogArguments.location.reload();window.close();</script>")
		Response.End
 End If
%>