<!--#include file="../conn.asp"-->
<!--#include file="inc/const.asp" -->
<!--#include file="../inc/dv_clsother.asp" -->
<!--#include file="../inc/GroupPermission.asp" -->
<!--#include file=../inc/md5.asp-->
<!--#include file="../inc/dv_loadcache.asp"-->
<!--#include file="../menpaiSet.asp"-->
<%
dim Meipai_inout_rate,maxtitleid
dim isZangmen'是否酋长人
isZangmen=false
founderr=false
set rs=conn.execute("select * from [Dv_GroupName] where Zangmen='"&dvbbs.membername&"'")
if not(rs.eof and rs.bof) then isZangmen=true

Meipai_inout_rate=split(conn.execute("select Meipai_inout_rate from [menpai]")(0),"|")
maxtitleid=conn.execute("select top 1 UserGroupID from [Dv_UserGroups] order by UserGroupID desc")(0)
'加入 社团 扣除 金钱，增加 经验，魄力，威望 的百分比1Meipai_inout_rate(0～3) Meipai_inout_rate((menpai_setting(0)-1)*4+0～3))
'加入 魔教 增加 金钱，扣除 经验，魄力，威望 的百分比2Meipai_inout_rate(4～7)Meipai_inout_rate((menpai_setting(0)-1)*4+0～3))

'退出 社团 增加 金钱，扣除 经验，魄力，威望 的百分比1Meipai_inout_rate(8～11)Meipai_inout_rate(menpai_setting(0)*4+5～7)) 
'退出 魔教 扣除 金钱，增加 经验，魄力，威望 的百分比2Meipai_inout_rate(12～15) Meipai_inout_rate(menpai_setting(0)*4+5～7))

'============================ 部落通用函数============================
'获取用户等级名          
function GetUserTitle(UserGroupID)
GetUserTitle=conn.execute("select usertitle from Dv_UserGroups where UserGroupID="&UserGroupID&"")(0)
end function
'获取用户等级数字
function GetUserGroupID(UserTitle)
GetUserGroupID=conn.execute("select UserGroupID from Dv_UserGroups where UserTitle='"&UserTitle&"'")(0)
end function
'获取部落属性
function MenpaiAttri(expression)
if expression=0 or expression="" then
MenpaiAttri=Sl1
elseif expression=1 then
MenpaiAttri=Sl2
elseif expression=2 then
MenpaiAttri=Sl3
elseif expression=3 then
MenpaiAttri="<font color=navy>Sl4</font>"
else
MenpaiAttri=Sl1
end if
end function
'获取部落状态
function MenpaiState(expression)
if expression=2 then
MenpaiState="<font color=red>已注销</font>"
elseif expression=3 then
MenpaiState="<font color=red>等待审核</font>"
else
MenpaiState="正常"
end if
end function
'获取加入部落时各项属性值增减的百分率
function GetMeipai_in_rate(menpaiattri) 
if cint(menpaiattri)=1 then
GetMeipai_in_rate="" 
elseif cint(menpaiattri)=2 then
GetMeipai_in_rate=""
else
GetMeipai_in_rate="0|0|0|0|0|0|0"
end if
end function
'计算字符串长度
function strLength(str)
'功能：1个英文算1个单位长度，1个中文算2个单位长度  
       ON ERROR RESUME NEXT
       dim WINNT_CHINESE
       WINNT_CHINESE    = (len("超贴")=2)
       if WINNT_CHINESE then
          dim l,t,c
          dim i
          l=len(str)
          t=l
          for i=1 to l
             c=asc(mid(str,i,1))
             if c<0 then c=c+65536
             if c>255 then
                t=t+1
             end if
          next
          strLength=t
       else 
          strLength=len(str)
       end if
       if err.number<>0 then err.clear
end function

'-------------------------------出错信息-------------------------------
sub menpai_err() 
%>
<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style="width:75%">
<tr><th height=25>部落错误信息</th></tr>
<tr><td width="100%" class=tablebody1><b>产生错误的可能原因：</b><br><br><li>您是否仔细阅读了部落说明和部落规则，可能您还没有登陆或者不具有使用当前功能的权限
<font color=red><%=errmsg%></font><br></td></tr>
<tr><td align=center height=26 class=tablebody2><a href="javascript:history.go(-1)">返回上一页</a></td></tr> 
</table>
<%
end sub

'-------------------------------成功信息-------------------------------
sub menpai_suc() 
%>
<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style="width:75%">
<tr><th height=25>部落操作成功</th></tr>
<tr><td width="100%" class=tablebody1><b>操作成功</b><br><font color=navy><%=sucmsg%></font><br></td></tr>
<tr><td align=center height=26 class=tablebody2><a href=<%=Request.ServerVariables("HTTP_REFERER")%>>返回上一页</a></td></tr>
</table>
<%
end sub
%>
<%
Head()
dim admin_flag
admin_flag=",36,"
dvbbs.stats="部落管理页面"
if not Dvbbs.master or instr(","&session("flag")&",",admin_flag)=0 then
Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=index.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
dvbbs_error()
else
dim GroupID,Groupname
select case Request("action")
case "add"
call  newmenpai()    ' 添加部落
case "applynewmenpai"
call applynewmenpai()
case "edit"
call edit()'修改部落
case "savedit"
call savedit()
case "del"
call del()'删除部落
case "editapply"
call editapply()  '修改申请创建部落的条件
case "saveditapply"
call saveditapply()
case "pass"'批准新部落成立
call pass()
case "repass"'重新开通已经注销的部落
call repass()
                        case "setJob"
                                call setjob()
case else
call main()
end select 
Footer()
end if
if founderr then call dvbbs_error()
'=========================================================
sub main()
%>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr>
<th height=21 align="left">部落管理 --> <a href=menpai.asp>部落列表</a> | <a href=menpai.asp?action=add>添加部落</a></th>
</tr>
</table>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  <tr>
    <th height=24>部落名称</th>
    <th height=24>现任酋长</th> 
    <th height=24>创建日期</th> 
    <th height=24>性质</th> 
    <th height=24>第子数</th> 
    <th height=24>金钱</th> 
    <th height=24>总帖数</th> 
    <th height=24>操作</th> 
  </tr>
  <%
'部落显示  开始  
dim rs1
dim Zangmen,TotalArticle,TotalWealth,TotalUsernum
dim menpai_setting
sql="select * from [Dv_GroupName] where state<2"
set rs=conn.execute(sql)
if rs.eof and rs.bof  then
response.write "<tr><td height=21 class=forumrow colspan=8><font color=red>本超贴暂时没有任何部落</font></td></tr>"
else 
do while not rs.eof
TotalArticle=0
TotalWealth=0
TotalUsernum=0
menpai_setting=split(rs("menpai_setting"),"|")
Zangmen=trim(rs("Zangmen"))
if Zangmen="" or isnull(Zangmen) then
Zangmen="<font color=#FF6666>- 竞选中 -</font>"
elseif Zangmen="-弃帮跑路-" then
Zangmen="<font color=#CC6666>弃帮跑路</font>"
else
Zangmen="<a href=dispuser.asp?name="&dvbbs.HTMLEncode(Zangmen)&" title=""查看该酋长人的资料"" target=_blank>"&Zangmen&"</a>"
end if

'统计指定部落的文章数、金钱数 和 弟子数（包括酋长）
set rs1=conn.execute("select sum(userpost),sum(userwealth),count(*) from [Dv_user] where usergroup='"&rs("GroupName")&"'")
if rs1(0)<>"" then TotalArticle=rs1(0)
if rs1(1)<>"" then TotalWealth=rs1(1)
if rs1(2)<>"" then TotalUsernum=rs1(2)
%>
<tr>
<td valign=middle align=center height=21 class=forumrow><a href="../menpaiadd.asp?menu=1&groupname=<%=rs("groupname")%>" ><%=rs("groupname")%></a></td>
<td valign=middle align=center height=21 class=forumrow><%=Zangmen%></td>
    <td valign=middle align=center height=21 class=forumrow><%=rs("addtime")%></td>
    <td valign=middle align=center height=21 class=forumrow><%=MenpaiAttri(menpai_setting(0))%></td>
    <td valign=middle align=center height=21 class=forumrow><%=TotalUsernum%></td>
    <td valign=middle align=center height=21 class=forumrow><%=TotalWealth%></td>
    <td valign=middle align=center height=21 class=forumrow><%=TotalArticle%></td>
    <td valign=middle align=center height=21 class=forumrow><a href="menpai.asp?id=<%=rs("id")%>&action=edit">修改</a> | <a href="menpai.asp?id=<%=rs("id")%>&action=del" onclick="{if(confirm('您确定要删除 <%=rs("groupname")%> 吗?')){return true;}return false;}">删除</a></td>
</tr> 
<%rs.movenext
loop
rs.close
end if
%>
<tr><td height=21 class=forumRowHighlight colspan=8></td></tr>
</table>                                                                                                                                                                                         
<%  
'部落显示  结束

'开创新部落部分  代码开始
dim new_menpai_setting
new_menpai_setting=split(conn.execute("select new_menpai_setting from [menpai]")(0),",")

'set rs=conn.execute("select userwealth,usercp,userep,userpower,userclass from [user] where username='"&dvbbs.MemberName&"'")
 
dim wumenwupai'收纳不属于任何部落弟子的部落
set rs=conn.execute("select GroupName from [Dv_GroupName] where state=1")  
if rs.eof and rs.bof then 
wumenwupai="尚未加入"
else
wumenwupai=rs(0)
end if
rs.close

dim mymenpai,CanCreateMenpai
CanCreateMenpai=true
set rs=conn.execute("select GroupName from [Dv_GroupName] where Zangmen='"&dvbbs.MemberName&"'")
if rs.eof and rs.bof then
mymenpai=conn.execute("select UserGroup from [Dv_user] where UserID="&dvbbs.UserID)(0)
if mymenpai=wumenwupai or mymenpai="尚未加入" then
mymenpai="<font color=navy>"&mymenpai&"</font>"
else
mymenpai="<font color=navy>"&mymenpai&"</font><font color=red>弟子</font>"
end if
else
mymenpai="<font color=navy>"&rs(0)&"</font><font color=red>酋长</font>"
end if    
%>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
<tr><th colspan=9 height=20>申请建立部落的条件</th></tr>
<tr>
<td align=center height=21 class=forumRowHighlight>项目</td>
    <td align=center height=21 class=forumRowHighlight>金钱</td>
<td align=center height=21 class=forumRowHighlight>魅力</td>
<td align=center height=21 class=forumRowHighlight>经验</td>
<td align=center height=21 class=forumRowHighlight>威望</td>
<td align=center height=21 class=forumRowHighlight>文章</td>
<td align=center height=21 class=forumRowHighlight>用户等级</td> 
<td align=center height=21 class=forumRowHighlight>审核</td> 
<td align=center height=21 class=forumRowHighlight>部落</td>
</tr>
<tr>
<td align=center height=21 class=forumrow>创建部落要求</td>
    <td align=center height=21 class=forumrow><%=new_menpai_setting(0)%>+<font color=red><%=new_menpai_setting(6)%></font></td>
<td align=center height=21 class=forumrow><%=new_menpai_setting(1)%></td>
<td align=center height=21 class=forumrow><%=new_menpai_setting(2)%></td>
<td align=center height=21 class=forumrow><%=new_menpai_setting(3)%></td>
<td align=center height=21 class=forumrow><%=new_menpai_setting(4)%></td>
<td align=center height=21 class=forumrow><%=GetUserTitle(new_menpai_setting(5))%>(<%=new_menpai_setting(5)%>级)</td>
<td align=center height=21 class=forumrow><%if cint(new_menpai_setting(7))=1 then

response.write "需要" 
else 
response.write "不需要" 
end if%></td>
<td align=center height=21 class=forumrow><%=wumenwupai%></td>
</tr>
<tr><td align=center height=21 class=forumRowHighlight colspan=9><a href=menpai.asp?action=editapply>修改</a></td></tr>
</table>
<%
'开创新部落部分  代码结束 

'等待审核的部落 代码开始
%>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  <tr><th height=24 colspan="5">等待审核的部落</th></tr> 
  <tr>
<td align=center height=21 class=forumRowHighlight>部落名称</th>
<td align=center height=21 class=forumRowHighlight>创始人</th> 
<td align=center height=21 class=forumRowHighlight>创建日期</th> 
<td align=center height=21 class=forumRowHighlight>性质</th> 
<td align=center height=21 class=forumRowHighlight>操作</th> 
  </tr>
<%
sql="select * from [Dv_GroupName] where state=3"
set rs=conn.execute(sql)
if rs.eof and rs.bof  then
response.write "<tr><td height=21 class=forumrow colspan=8><font color=navy>暂时没有等待审核的部落</font></td></tr>"
else 
do while not rs.eof
menpai_setting=split(rs("menpai_setting"),"|")
Zangmen=trim(rs("Zangmen"))
%>
<tr>
<td valign=middle align=center height=21 class=forumrow><a href="../menpaiadd.asp?menu=1&groupname=<%=rs("groupname")%>" title="部落简介:<%=menpai_setting(7)%>"><%=rs("groupname")%></a></td>
<td valign=middle align=center height=21 class=forumrow><a href=dispuser.asp?name=<%=dvbbs.HTMLEncode(Zangmen)%> title="查看该酋长人的资料" target=_blank><%=Zangmen%></a></td>
    <td valign=middle align=center height=21 class=forumrow><%=rs("addtime")%></td>
    <td valign=middle align=center height=21 class=forumrow><%=MenpaiAttri(menpai_setting(0))%></td>
    <td valign=middle align=center height=21 class=forumrow><a href="menpai.asp?id=<%=rs("id")%>&Zangmen=<%=Zangmen%>&action=pass">批准</a> | <a href="menpai.asp?id=<%=rs("id")%>&action=edit">编辑</a> | <a href="menpai.asp?id=<%=rs("id")%>&Zangmen=<%=Zangmen%>&action=del" onclick="{if(confirm('您确定删除 <%=rs("groupname")%> 吗?')){return true;}return false;}">删除</a></td>
</tr>
<%rs.movenext
loop
rs.close
end if
%>
<tr><td height=21 class=forumRowHighlight colspan=5></td></tr>
</table>
<%
'等待审核的部落  代码结束

'已注销的部落  代码开始
%>
<br>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  <tr><th height=24 colspan="4">已注销的部落</th></tr> 
  <tr>
<td align=center height=21 class=forumRowHighlight>部落名称</th>
<td align=center height=21 class=forumRowHighlight>创建日期</th> 
<td align=center height=21 class=forumRowHighlight>性质</th> 
<td align=center height=21 class=forumRowHighlight>操作</th> 
  </tr>
<%
sql="select * from [Dv_GroupName] where state=2"
set rs=conn.execute(sql)
if rs.eof and rs.bof  then
response.write "<tr><td height=21 class=forumrow colspan=8><font color=navy>暂时没有已注销的部落</font></td></tr>"
else 
do while not rs.eof
menpai_setting=split(rs("menpai_setting"),"|")
%>
<tr>
<td valign=middle align=center height=21 class=forumrow><a href="../menpaiadd.asp?menu=1&groupname=<%=rs("groupname")%>" title="部落简介:<%=menpai_setting(7)%>"><%=rs("groupname")%></a></td>
    <td valign=middle align=center height=21 class=forumrow><%=rs("addtime")%></td>
    <td valign=middle align=center height=21 class=forumrow><%=MenpaiAttri(menpai_setting(0))%></td>
    <td valign=middle align=center height=21 class=forumrow><a href="menpai.asp?id=<%=rs("id")%>&action=repass">重开</a> | <a href="menpai.asp?id=<%=rs("id")%>&action=edit">编辑</a> | <a href="menpai.asp?id=<%=rs("id")%>&action=del" onclick="{if(confirm('您确定退出 <%=rs("groupname")%> 吗?')){return true;}return false;}">删除</a></td>
</tr>
<%rs.movenext
loop
rs.close
end if
%>
<tr><td height=21 class=forumRowHighlight colspan=5></td></tr>
</table>
<%
'已注销的部落  代码结束
end sub
'---------------------------部落管理====设置职位页面------------------------------
sub setjob()
dim UserName,menpai_Job,GroupName
GroupName=dvbbs.checkStr(trim(Request.form("groupname")))
UserName=Request.form("UserName")
        menpai_Job=Request.form("JobName")
if username="" or isnull(username) then
Errmsg=Errmsg+"<br>"+"<li>请输入您想设置职位的用户名"
Founderr=true
end if
Set rs= Server.CreateObject("ADODB.Recordset")                                                                                                                                                                                                                                   
sql="select * from [Dv_user] where username='"&Username&"'"                                                                                                                                                                                                                                   
rs.open sql,conn,1,3                                                                                              
if rs.eof and rs.bof then                                                                                             
Errmsg=Errmsg+"<br>"+"<li>您输入的用户不存在"
Founderr=true
exit sub
elseif rs("usergroup")<>Groupname then                                                                                             
Errmsg=Errmsg+"<br>"+"<li>您输入的用户不是本部落弟子"
Founderr=true
exit sub                                                                                            
else
rs("Menpai_Job")=menpai_Job
rs.update                                                                                             
end if                                                                                                                                                                                            
rs.close                                                                                             
set rs=nothing   
%>
<br><br><p><b>修改部落成功</b>&nbsp;&nbsp;<a href=menpai.asp>返回</a></p>
<%  
end sub                                                       
'----------------------------添加新部落------------------------------
sub newmenpai()       
%>                                                                                             
<table cellspacing=1 align=center class=tableborder width="95%">                                                                                                                                                                              
<form name="form" method="post" action="menpai.asp?action=applynewmenpai">                                                                                                                                                                                            
  <tr>                                                                                                                                                                                           
    <th valign=middle align=center height=24 colspan="4">添加新部落</th>                                                                                                                                                                                          
  </tr> 
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>                                                                                                                                                                                        
  <tr> 
<td valign=middle align=left class=forumRowHighlight height="22"><b>部落名称:</b><br> 部落名称申请之后酋长不能修改</td> 
<td valign=middle align=left class=forumrow height="22" colspan="3">&nbsp;<INPUT name=groupname size="20" maxlength="20"> <font color=red>*</font> (不要超过12个英文字母或6个汉字)</td>
  </tr>
  <tr> 
<td valign=middle align=left class=forumRowHighlight height="22"><b>酋长:</b><br> 如果暂时不想设置酋长，可以先留空</td> 
<td valign=middle align=left class=forumrow height="22" colspan="3">&nbsp;<INPUT name=Zangmen size="20" maxlength="20" value=<%=dvbbs.MemberName%>></td>
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>
    <tr>
<td valign=middle align=left class=forumRowHighlight height="22"><b>部落性质说明:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=forumrow height="22" colspan="3">
<li><%=Sl4%>是收留所有尚未加入的人的一个特殊部落
<li>新注册用户和被酋长踢出部落的用户自动加入<%=Sl4%>
 <li>只能存在一个<%=Sl4%>，所以当您设置一个部落为<%=Sl4%>之后，以前的<%=Sl4%>自动转为正常部落
</td> 
  </tr>
  <tr> 
<td valign=middle align=left class=forumRowHighlight height="22"><b>部落性质:</b><br> 部落性质申请之后酋长不能修改</td>
<td valign=middle align=left class=forumrow height="22" colspan="3">
<input type=radio name=menpaiattri value=0 checked><%=Sl1%>&nbsp;
<input type=radio name=menpaiattri value=1><%=Sl2%>&nbsp;
<input type=radio name=menpaiattri value=2><%=Sl3%>&nbsp;
<input type=radio name=menpaiattri value=3><%=Sl4%><br>
</td>
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>
    <tr>
<td valign=middle align=left class=forumRowHighlight height="22"><b>门限值的说明:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=forumrow height="22" colspan="3">
 
        <li>金钱,魅力,经验,威望,文章数 都不能超过您自已的当前值 
        <li>金钱,魅力,经验,威望,文章数 是加入本部落的必须满足的最小值 
        <li>金钱,魅力,经验,威望,文章数 也是加入和退出部落增加/扣除相关值时的基数 
        <li><%=Sl1%>不受以上限制
<li>以下属性酋长可以在部落管理中修改
</td> 
  </tr> 
    <tr>                                                                                                                                                                                         
<td valign=middle align=left class=forumRowHighlight height="22" width="25%"><b>金钱:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userwealth value=""></td>                                                                                                                                                                                        
<td valign=middle align=right class=forumRowHighlight height="22">您的金钱:&nbsp;</td>
<td valign=middle align=left class=forumrow height="22" width="20%">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text%></td>
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>经验:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userep value=""></td>
<td valign=middle align=right class=forumRowHighlight height="22">您的经验:&nbsp;</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>魅力:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=usercp value=""></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的魅力:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>威望:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userpower value=""></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的威望:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>文章数:</b><br>加入本部落必须达到的发贴数</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userarticle value=""></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的贴数:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>用户等级:</b><br>加入本部落必须具备的等级(1～<%=maxtitleid%>)</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userclass value=""></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的等级:&nbsp;</td>                                                                                                                                                                                     
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text%>（<%=GetUserGroupID(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text)%>级）</td>                                                                                                                                                                                      
  </tr>
<tr>

      <td valign=middle align=center class=forumrow height=22 colspan="4"><font color="#CC9933"> 
        如果部落性质是<font color=red><%=Sl1%></font>或<font color=red><%=Sl4%></font>，则以上6项(金钱,魅力,经验,威望,文章数)不必填写</font> 
      </td>
</tr> 
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>本部落简介:</b><br>对您的部落作简单的介绍，在您的部落资料中会显示出来</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow colspan="3" height="22">&nbsp;<textarea name=menpaireadme rows="4" cols="60"></textarea>(不要超过100个英文或50个汉字)</td>                                                                                                                                                                                      
  </tr>  
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                       
    <td valign=middle align=center class=forumrow colspan="4" height="22"><INPUT type=submit value=添加 name=submit></td>                                                                                                                                                                                       
  </tr>                                                                                                                                                                              
  </form>                                                                                                                                                                                    
</table>                                                                                                                                                                                           
<%                                             
end sub                                                                                                                                                                                                                            

'------------------------------------添加部落成功--------------------------------
sub applynewmenpai() 

dim MenpaiAttri,userwealth,usercp,userep,userpower,userclass,userartitle,Zangmen
GroupName=dvbbs.checkstr(trim(Request.form("groupname")))
MenpaiAttri=Request.form("menpaiattri")
Zangmen=trim(Request.form("Zangmen"))

if GroupName="" then
Errmsg=Errmsg+"<br>"+"<li>请输入部落名称"
founderr=true
elseif strLength(GroupName)>12 then
Errmsg=Errmsg+"<br>"+"<li>部落名称不能超过12个英文字母(6个汉字)"
founderr=true
end if
if cint(MenpaiAttri)<>0 and cint(MenpaiAttri)<>3 then
if not isnumeric(Request.form("userwealth")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写金钱值或者您填入的不是有效的数值"
founderr=true
elseif int(Request.form("userwealth"))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text then
Errmsg=Errmsg+"<br>"+"<li>您输入的金钱有效值大于您自己的当前值！"
founderr=true
else
userwealth=int(Request.form("userwealth"))
end if
if not isnumeric(Request.form("userep")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写经验值或者您填入的不是有效的数值"
founderr=true
elseif int(Request.form("userep"))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text then
Errmsg=Errmsg+"<br>"+"<li>您输入的经验有效值大于您自己的当前值！"
founderr=true
else 
userep=int(Request.form("userep"))
end if
if not isnumeric(Request.form("usercp")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写魅力值或者您填入的不是有效的数值"
founderr=true
elseif int(Request.form("usercp"))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text then
Errmsg=Errmsg+"<br>"+"<li>您输入的魅力有效值大于您自己的当前值！"
founderr=true
else 
usercp=int(Request.form("usercp"))
end if
if not isnumeric(Request.form("userpower")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写威望值或者您填入的不是有效的数值"
founderr=true
elseif int(Request.form("userpower"))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text then
Errmsg=Errmsg+"<br>"+"<li>您输入的威望有效值大于您自己的当前值！"&Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text
founderr=true
else 
userpower=int(Request.form("userpower"))
end if
if not isnumeric(Request.form("userarticle")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写文章数或者您填入的不是有效的数值"
founderr=true
elseif int(Request.form("userarticle"))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text  then
Errmsg=Errmsg+"<br>"+"<li>您输入的文章有效值大于您自己的当前值！"
founderr=true
else 
userartitle=int(Request.form("userarticle"))
end if
if not isnumeric(Request.form("userclass")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写威望值或者您填入的不是有效的数值"
founderr=true
elseif int(Request.form("userclass"))>1 then
Errmsg=Errmsg+"<br>"+"<li>您输入的等级有效值大于您自己的当前值！"
founderr=true
elseif int(Request.form("userclass"))<1 or int(Request.form("userclass"))>int(maxtitleid) then
Errmsg=Errmsg+"<br>"+"<li>等级值不能小于1或大于"&maxtitleid
founderr=true
else 
userclass=int(Request.form("userclass"))
end if
else
userwealth=0
userep=0
usercp=0
userpower=0
userartitle=0
userclass=1
end if

dim menpaireadme
menpaireadme=Request.form("menpaireadme")
if strLength(menpaireadme)>100 then
Errmsg=Errmsg+"<br>"+"<li>部落简介不能超过100个英文或50个汉字"
founderr=true
end if

if Zangmen<>"" then
set rs=conn.execute("select usergroup from [Dv_user] where username='"&Zangmen&"'")
if rs.eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>您指定为酋长的用户不存在"
founderr=true
end if
end if

if founderr then exit sub
                           
set rs= server.createobject ("adodb.recordset")                                                                                                                                                                                                                                   
sql="select * from [Dv_GroupName] where groupname='"&groupname&"'"                                                                                                                                                                                                                                   
rs.Open sql,conn,1,3                                                                                                                                                                                                            
if not(rs.bof and rs.eof) then                                                                               
Errmsg=Errmsg+"<br>"+"<li>您输入的部落名字已经存在"
founderr=true
rs.close
set rs=nothing
exit sub
else                                  
rs.addnew                                                                                                                                                          
rs("Groupname")=GroupName
rs("Zangmen")=Zangmen
rs("Addtime")=date()
rs("Menpai_setting")=MenpaiAttri & "|" & userwealth & "|" & userep & "|" & usercp & "|" & userpower & "|" & userartitle & "|" &userclass& "|" & menpaireadme
if cint(MenpaiAttri)=3 then
rs("State")=1
conn.execute("update [Dv_GroupName] set State=0 where State=1")
else
rs("State")=0
end if
rs.update  
if Zangmen<>"" then conn.execute("update [Dv_user] set usergroup='"&GroupName&"' where username='"&Zangmen&"'")
end if
%>
<br><p><b>添加部落成功</b>&nbsp;&nbsp;<a href=menpai.asp>返回</a></p>
<% 
end sub 
 
sub edit() 
GroupID=request("ID")
if GroupID="" and (not isnumeric(GroupID)) then
Errmsg=Errmsg+"<br>"+"<li>错误的部落参数"
founderr=true
exit sub
end if
dim Zangmen,Addtime,Menpai_setting
sql="select * from [Dv_GroupName] where id="&GroupID&""
set rs=conn.execute(sql)
if not(rs.eof and rs.bof) then
GroupName=rs("GroupName")
Zangmen=trim(rs("Zangmen"))
Addtime=rs("Addtime")
Menpai_setting=split(rs("Menpai_setting"),"|")
else
Errmsg=Errmsg+"<br>"+"<li>错误的部落参数,指定部落不存在"
founderr=true
exit sub
end if
rs.close
%>   
<table cellspacing=1 align=center class=tableborder width="95%">                                                                                                                                                                              
  <tr>                                                                                                                                                                                           
    <td valign=middle align=center height=24 class=forumRowHighlight colspan="4">部落管理</td>                                                                                                                                                                                          
  </tr> 
<form name="form" method="post" action="menpai.asp?action=savedit">                                                                                                                                                                                            
  <tr>                                                                                                                                                                                           
    <th valign=middle align=left height=24 colspan="4">&nbsp;★&nbsp; 部落基本设置</th>                                                                                                                                                                                          
  </tr> 
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>                                                                                                                                                                                        
  <tr> 
<td valign=middle align=left class=forumRowHighlight height="22"><b>部落名称:</b><br> 部落名称酋长不能修改</td> 
<td valign=middle align=left class=forumrow height="22" colspan="3">&nbsp;<INPUT name=GroupName size="20" maxlength="20" value=<%=GroupName%>> <font color=red>*</font> (不要超过12个英文字母或6个汉字)<INPUT name=GroupID size="20" maxlength="20" type=hidden value=<%=GroupID%>></td>
  </tr>
  <tr> 
<td valign=middle align=left class=forumRowHighlight height="22"><b>酋长:</b><br> 如果不想设置任何人做酋长，可以留空</td> 
<td valign=middle align=left class=forumrow height="22" colspan="3">&nbsp;<INPUT name=Zangmen size="20" maxlength="20" value=<%=Zangmen%>></td>
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>
    <tr>
<td valign=middle align=left class=forumRowHighlight height="22"><b>部落性质说明:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=forumrow height="22" colspan="3">
<li><%=Sl4%>是收留所有尚未加入的人的一个特殊部落
<li>新注册用户和被酋长踢出部落的用户自动加入<%=Sl4%>
 <li>只能存在一个<%=Sl4%>，所以当您设置一个部落为<%=Sl4%>之后，以前的<%=Sl4%>自动转为正常部落
<li>选择<%=Sl1%>或<%=Sl4%>会清除以前设置的金钱,魅力,经验,威望,文章数,用户等级的值(都为0)
</td> 
  </tr>
  <tr> 
<td valign=middle align=left class=forumRowHighlight height="22"><b>部落性质:</b><br> 部落性质申请之后酋长不能修改</td>
<td valign=middle align=left class=forumrow height="22" colspan="3">
<input type=radio name=MenpaiAttri value=0 <%if cint(menpai_setting(0))=0 then%>checked<%end if%>><%=Sl1%>&nbsp;
<input type=radio name=MenpaiAttri value=1 <%if cint(menpai_setting(0))=1 then%>checked<%end if%>><%=Sl2%>&nbsp;
<input type=radio name=MenpaiAttri value=2 <%if cint(menpai_setting(0))=2 then%>checked<%end if%>><%=Sl3%>&nbsp;
<input type=radio name=MenpaiAttri value=3 <%if cint(menpai_setting(0))=3 then%>checked<%end if%>><%=Sl4%>
</td>
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>
  <tr> 
<td valign=middle align=left class=forumRowHighlight height="22"><b>建立时间:</b><br>
        部落创建的时间，格式 2004-1-14</td> 
<td valign=middle align=left class=forumrow height="22" colspan="3">&nbsp;<INPUT name=Addtime size="20" maxlength="20" value=<%=Addtime%>></td>
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>
    <tr>
<td valign=middle align=left class=forumRowHighlight height="22"><b>门限值说明:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=forumrow height="22" colspan="3">
 
        <li>金钱,魅力,经验,威望,文章数 都不能超过您自已的当前值 
        <li>金钱,魅力,经验,威望,文章数 是加入本部落的必须满足的最小值 
        <li>金钱,魅力,经验,威望,文章数 也是加入和退出部落增加/扣除相关值时的基数 
        <li>明门正派和中立派 不受以上限制
</td> 
  </tr> 
    <tr>                                                                                                                                                                                         
<td valign=middle align=left class=forumRowHighlight height="22" width="30%"><b>金钱:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userwealth value=<%=menpai_setting(1)%>></td>                                                                                                                                                                                        
<td valign=middle align=right class=forumRowHighlight height="22">您的金钱:&nbsp;</td>
<td valign=middle align=left class=forumrow height="22" width="20%">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text%></td>
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>经验:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userep value=<%=menpai_setting(2)%>></td>
<td valign=middle align=right class=forumRowHighlight height="22">您的经验:&nbsp;</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>魅力:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=usercp value=<%=menpai_setting(3)%>></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的魅力:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>威望:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userpower value=<%=menpai_setting(4)%>></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的威望:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>文章数:</b><br>加入本部落必须达到的发贴数</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userarticle value=<%=menpai_setting(5)%>></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的贴数:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>用户等级:</b><br>加入本部落必须具备的等级(1～<%=maxtitleid%>)</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userclass value=<%=menpai_setting(6)%>></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的等级:&nbsp;</td>                                                                                                                                                                                     
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text%>（<%=GetUserGroupID(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text)%>级）</td>                                                                                                                                                                                      
  </tr>
<tr>

      <td valign=middle align=center class=forumrow height=22 colspan="4"><font color="#CC9933"> 
        如果部落性质是<font color=red><%=Sl1%></font>或<font color=red><%=Sl4%></font>，则以上6项(金钱,魅力,经验,威望,文章数)不必填写</font> 
      </td>
</tr> 
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>本部落简介:</b><br>对您的部落作简单的介绍，在您的部落资料中会显示出来</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow colspan="3" height="22">&nbsp;<textarea name=menpaireadme rows="4" cols="60"><%=menpai_setting(7)%></textarea>(不要超过100个英文或50个汉字)</td>                                                                                                                                                                                      
  </tr>  
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                       
    <td valign=middle align=center class=forumrow colspan="4" height="22"><INPUT type=submit value=更新 name=submit></td>                                                                                                                                                                                       
  </tr> 
<tr>
<th valign=middle align=left height=24 colspan="4" >&nbsp;◆&nbsp;<b>部落职位设置</b></th>                                                                                                                                                                                         
</tr>                                                                                                                                                                    
  </form>
        <tr>
        <form name="form99" method="post" action="menpai.asp?action=setJob">
        <INPUT name=Groupname size="20" value="<%=groupname%>" type=hidden> 
        <td valign=middle align=left class=forumrow height="22">
         <b>弟子名称:</b></td><td valign=middle align=left class=forumrow colspan="3"><INPUT name=Username size="20"></td>
        </tr>
        <tr>
        <td valign=middle align=left class=tablebody2 height="22">
         <b>职位名称:</b></td><td valign=middle align=left class=forumrow colspan="3"><INPUT name=Jobname size="20"></td>
        </tr><tr><td valign=middle align=center class=forumrow colspan="4" height="22"><INPUT type=submit value=更新 name=submit></td>
        </form></tr>                                                                                                                                                                             
  </form>     
</table>    
                                                                                                                                                                           
<%                                                                                                                                                                                                                             
end sub

sub savedit()
                                                                                                                                                   
dim MenpaiAttri,userwealth,usercp,userep,userpower,userclass,userartitle,Addtime,Zangmen
GroupID=Request.form("GroupID")
GroupName=dvbbs.checkstr(trim(Request.form("GroupName")))
MenpaiAttri=Request.form("MenpaiAttri")
Zangmen=trim(Request.form("Zangmen"))
Addtime=Request.form("Addtime")

if GroupName="" then
Errmsg=Errmsg+"<br>"+"<li>请输入部落名称"
founderr=true
elseif strLength(GroupName)>12 then
Errmsg=Errmsg+"<br>"+"<li>部落名称不能超过12个英文字母(6个汉字)"
founderr=true
end if
if cint(MenpaiAttri)<>0 and cint(MenpaiAttri)<>3 then
if not isnumeric(Request.form("userwealth")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写金钱值或者您填入的不是有效的数值"
founderr=true
else
userwealth=int(Request.form("userwealth"))
end if
if not isnumeric(Request.form("userep")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写经验值或者您填入的不是有效的数值"
founderr=true
else 
userep=int(Request.form("userep"))
end if
if not isnumeric(Request.form("usercp")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写魅力值或者您填入的不是有效的数值"
founderr=true
else 
usercp=int(Request.form("usercp"))
end if
if not isnumeric(Request.form("userpower")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写威望值或者您填入的不是有效的数值"
founderr=true
else 
userpower=int(Request.form("userpower"))
end if
if not isnumeric(Request.form("userarticle")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写文章数或者您填入的不是有效的数值"
founderr=true
else 
userartitle=int(Request.form("userarticle"))
end if
if not isnumeric(Request.form("userclass")) then
Errmsg=Errmsg+"<br>"+"<li>必须填写威望值或者您填入的不是有效的数值"
founderr=true
elseif int(Request.form("userclass"))<1 or int(Request.form("userclass"))>int(maxtitleid) then
Errmsg=Errmsg+"<br>"+"<li>等级值不能小于1或大于"&maxtitleid
founderr=true
else 
userclass=int(Request.form("userclass"))
end if
else
userwealth=0
userep=0
usercp=0
userpower=0
userartitle=0
userclass=1
end if

if Zangmen<>"" then
set rs=conn.execute("select usergroup from [Dv_user] where username='"&Zangmen&"'")
if rs.eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>您指定为酋长的用户不存在"
founderr=true
end if
end if 

dim menpaireadme
menpaireadme=Request.form("menpaireadme")
if strLength(menpaireadme)>100 then
Errmsg=Errmsg+"<br>"+"<li>部落简介不能超过100个英文或50个汉字"
founderr=true
end if

if founderr then exit sub

set rs= server.createobject ("adodb.recordset")                                                                                                                                                                                                                                   
sql="select * from [Dv_GroupName] where ID="&GroupID&""                                                                                                                                                                                                                                   
rs.Open sql,conn,1,3  
 
if rs.bof and rs.eof then                                                                          
Errmsg=Errmsg+"<br>"+"<li>该部落不存在啊"
founderr=true
rs.close
set rs=nothing
exit sub
else                                  
rs("Groupname")=GroupName
rs("Zangmen")=Zangmen
if cint(MenpaiAttri)=3 then
rs("State")=1
conn.execute("update [Dv_GroupName] set State=0 where State=1")
else
rs("State")=0
end if
rs("Menpai_setting")=MenpaiAttri & "|" & userwealth & "|" & userep & "|" & usercp & "|" & userpower & "|" & userartitle & "|" &userclass& "|" & menpaireadme
if isdate(Addtime) then rs("Addtime")=Addtime
rs.update  
if Zangmen<>"" then conn.execute("update [Dv_user] set usergroup='"&GroupName&"' where username='"&Zangmen&"'")
end if
%>
<br><br><p><b>修改部落成功</b>&nbsp;&nbsp;<a href=menpai.asp>返回</a></p>
<%
end sub

sub editapply() 
dim newmenpai_setting
newmenpai_setting=split(conn.execute("select new_menpai_setting from [menpai]")(0),",")
%>   
<br>
<table cellspacing=1 align=center class=tableborder width="95%">                                                                                                                                                                              
  <tr>                                                                                                                                                                                           
    <th valign=middle height=24 colspan="4">部落申请条件管理</td>                                                                                                                                                                                          
  </tr> 
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>        
<form name="form" method="post" action="menpai.asp?action=saveditapply">                                                                                                                                                                                 
    <tr>
<td valign=middle align=left class=forumRowHighlight height="22"><b>说明:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=forumrow height="22" colspan="3">
<li>前台用户可以自己创建部落必须满足的条件
<li>条件最好不要设置的太低，否则很多人都符号创建部落要求
<li>您的属性值是用来参考的，输入的值不受您的属性值的限制
<li>请输入数字,不要输入负数和字母
</td> 
  </tr> 
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>
    <tr>                                                                                                                                                                                         
<td valign=middle align=left class=forumRowHighlight height="22" width="30%"><b>金钱:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userwealth value=<%=newmenpai_setting(0)%>></td>                                                                                                                                                                                        
<td valign=middle align=right class=forumRowHighlight height="22">您的金钱:&nbsp;</td>
<td valign=middle align=left class=forumrow height="22" width="20%">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text%></td>
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>经验:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userep value=<%=newmenpai_setting(1)%>></td>
<td valign=middle align=right class=forumRowHighlight height="22">您的经验:&nbsp;</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>魅力:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=usercp value=<%=newmenpai_setting(2)%>></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的魅力:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>威望:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userpower value=<%=newmenpai_setting(3)%>></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的威望:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>文章数:</b><br>加入本部落必须达到的发贴数</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userarticle value=<%=newmenpai_setting(4)%>></td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的贴数:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text%></td>                                                                                                                                                                                        
  </tr> 
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>用户等级:</b><br>加入本部落必须具备的等级(1～<%=maxtitleid%>)</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22">&nbsp;<INPUT name=userclass value=<%=newmenpai_setting(5)%>>&nbsp;</td> 
<td valign=middle align=right class=forumRowHighlight height="22">您的等级:&nbsp;</td>                                                                                                                                                                                     
<td valign=middle align=left class=forumrow height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text%>（<%=GetUserGroupID(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text)%>级）</td>                                                                                                                                                                                      
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>  
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=forumRowHighlight height="22"><b>创建部落收费:</b><br>申请部落时收取的费用</td>                                                                                                                                                                                        
<td valign=middle align=left class=forumrow height="22" colspan="3">&nbsp;<INPUT name=creatmoney value=<%=newmenpai_setting(6)%>>
&nbsp;<font color=navy>注意：前台创建部落条件中的金钱项 = 前面的金钱 + <font color=red>创建部落收费</font></font>
</td> 
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>  
  <tr>                                                                                                                                                                                         
<td valign=middle align=left class=forumRowHighlight height="22"><b>审核选项:</b><br>用户申请部落之后是否需要通过管理员审核之后才能正式成立</td>                                                                                                                                                                                         
<td valign=middle align=left class=forumrow height="22" colspan="3">&nbsp;
<input type=radio name=shenhe value=0 <%if cint(newmenpai_setting(7))=0 then%>checked<%end if%>>直接开通&nbsp;
<input type=radio name=shenhe value=1 <%if cint(newmenpai_setting(7))=1 then%>checked<%end if%>>需要通过审核后才能开通&nbsp;
</td> 
  </tr>
<tr><td height=8 class=forumRowHighlight colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                       
    <td valign=middle align=center class=forumrow colspan="4" height="22"><INPUT type=submit value=更新 name=submit></td>                                                                                                                                                                                       
  </tr>                                                                                                                                                                              
  </form>     
</table>    
<%                                                                                                                                                                                                                             
end sub

sub saveditapply()
dim maxtitleid,creatmoney
dim MenpaiAttri,userwealth,usercp,userep,userpower,userclass,userartitle,Addtime,Zangmen

if not isnumeric(Request.form("userwealth")) then
Errmsg=Errmsg+"<br>"+"<li>您输入的金钱值不是有效的数值"
founderr=true
else
userwealth=int(Request.form("userwealth"))
end if
if not isnumeric(Request.form("userep")) then
Errmsg=Errmsg+"<br>"+"<li>您输入的经验值不是有效的数值"
founderr=true
else 
userep=int(Request.form("userep"))
end if
if not isnumeric(Request.form("usercp")) then
Errmsg=Errmsg+"<br>"+"<li>您输入的魅力值不是有效的数值"
founderr=true
else 
usercp=int(Request.form("usercp"))
end if
if not isnumeric(Request.form("userpower")) then
Errmsg=Errmsg+"<br>"+"<li>您输入的威望值不是有效的数值"
founderr=true
else 
userpower=int(Request.form("userpower"))
end if
if not isnumeric(Request.form("userarticle")) then
Errmsg=Errmsg+"<br>"+"<li>您输入的文章值不是有效的数值"
founderr=true
else 
userartitle=int(Request.form("userarticle"))
end if
maxtitleid=conn.execute("select top 1 UserGroupID from [Dv_UserGroups] order by UserGroupID desc")(0)
if not isnumeric(Request.form("userclass")) then
Errmsg=Errmsg+"<br>"+"<li>您输入的等级值不是有效的数值"
founderr=true
elseif int(Request.form("userclass"))<1 or int(Request.form("userclass"))>int(maxtitleid) then
Errmsg=Errmsg+"<br>"+"<li>等级值不能小于1或大于"&maxtitleid
founderr=true
else 
userclass=int(Request.form("userclass"))
end if
if not isnumeric(Request.form("creatmoney")) then
Errmsg=Errmsg+"<br>"+"<li>您输入的创建部落费用不是有效的数值"
founderr=true
else
creatmoney=int(Request.form("creatmoney"))
end if

if founderr then exit sub
conn.execute("update menpai set new_menpai_setting='" & userwealth & "," & usercp & "," & userep & "," & userpower & "," & userartitle & "," &userclass& "," & creatmoney & "," & Request.form("shenhe") & "'")
%>
<br><br><p>&nbsp;<b>修改创建部落条件成功</b>&nbsp;&nbsp;<a href=menpai.asp>返回</a></p>
<%
end sub
'------------------删除部落----------------------
sub del()
conn.execute("delete from Dv_GroupName where id="&request("id"))
if request("Zangmen")<>"" then call sendmessage(request("Zangmen"),dvbbs.MemberName,"部落审核通知","真是抱歉，您新创建的部落没有通过审核")
%>
<br><br><p><b>删除部落成功</b>&nbsp;&nbsp;<a href=menpai.asp>返回</a></p>
<%
end sub
'------------------批准部落成立------------------
sub pass()
conn.execute("update Dv_GroupName set state=0 where id="&request("id"))
if request("Zangmen")<>"" then call sendmessage(request("Zangmen"),dvbbs.MemberName,"部落开通通知","经过审核，您开创的部落已经可以开通了，希望您能够管理好您的部落，谢谢!")
%>
<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style="width:75%">
<tr><th height=25>成功信息</th></tr>
<tr><td width="100%" class=tablebody1><b>操作成功：</b><br><li><b>您批准了该部落成立</b></p>
</td></tr>
<tr><td align=center height=26 class=tablebody2>&nbsp;&nbsp;<a href=menpai.asp>返回</a></td></tr>
</table>
<%
end sub 
'------------------重新开通已经注销的部落------------------
sub repass()
conn.execute("update Dv_GroupName set state=0,zangmen='' where id="&request("id"))
%>
<br><br><p><b>部落重开成功，请在部落管理中修改部落的基本资料和酋长</b>&nbsp;&nbsp;<a href=menpai.asp>返回</a></p>
<%
end sub 
'--------------------------------发送短信息--------------------------------
sub sendmessage(incept,sender,title,message)
sql="insert into Dv_message (incept,sender,title,content,sendtime,flag,issend) values ('"&incept&"','"&sender&"','"&title&"','"&message&"',Now(),0,1)"                                          
conn.execute(sql)                                          
end sub 
%>