<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp" -->
<!--#include file="inc/dv_clsother.asp" -->
<!--#include file="inc/GroupPermission.asp" -->
<!--#include file="inc/dv_loadcache.asp"-->
<!--#include file="inc/plus_check.asp"-->
<!-- #include file="menpaiconn.asp" -->
<%
'加入 社团 扣除 金钱，增加 经验，魄力，威望 的百分比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))

If Not IsObject(Conn) Then ConnectionDatabase
dim sql,rs,founderr,i,errmsg
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)
founderr=false
Dvbbs.LoadTemplates("")
%>
<%dim sucmsg
dim Meipai_inout_rate,maxtitleid
dim isZangmen'是否首脑
isZangmen=false
set rs=conn.execute("select * from [Dv_GroupName] where Zangmen='"&dvbbs.membername&"'")
if not(rs.eof and rs.bof) then isZangmen=true
'========================主程序开始===========================
dim menu,GroupName,chenbackasp,chentitle,User
menu=request.querystring("menu")
GroupName=dvbbs.checkstr(Trim(Request("GroupName")))
if menu="" then menu=0

chenbackasp="menpai.asp"
chentitle="超贴"&Mpmc
dvbbs.stats="超贴"&Mpmc&dvbbs.htmlencode(GroupName)
dvbbs.nav

select case menu
case 2
dvbbs.stats="超贴"&Mpmc&" 加入"&Mpmc&dvbbs.htmlencode(GroupName)
case 3
dvbbs.stats="超贴"&Mpmc&" 退出"&Mpmc&dvbbs.htmlencode(GroupName)
case 4,5,6,9
chenbackasp="menpaiadd.asp?GroupName="&dvbbs.htmlencode(GroupName)
chentitle=dvbbs.HTMLEncode(GroupName)
dvbbs.stats=dvbbs.HTMLEncode(GroupName)&Mpmc&"管理"
case 7,8
dvbbs.stats="超贴"&Mpmc&" 申请新"&Mpmc
end select
call Dvbbs.head_var(3,Dvbbs.Stats,"超贴"&Mpmc,"menpai.asp")

if not dvbbs.founduser then
dvbbs.stats="超贴"&Mpmc&" 错误信息"
Errmsg=Errmsg+"<br>"+"<li>您没有进入超贴"&Mpmc&"的权限，请先登陆或者同管理员联系。"
call dvbbs_error()
'call menpai_err()
else
'读取指定部落的值
dim Menpai_setting,Zangmen,ZangmenStr,Addtime,States 
dim CanManage'能否管理本部落，必须本部落首脑才能管理本部落
CanManage=false 

if GroupName<>"" and (not isnull(GroupName)) then
sql="select * from [Dv_GroupName] where groupname='"&GroupName&"'"
set rs=conn.execute(sql)
if not(rs.eof and rs.bof) then
GroupName=rs("GroupName")
Zangmen=trim(rs("Zangmen"))
Addtime=rs("Addtime")
States=rs("State")
Menpai_setting=split(rs("Menpai_setting"),"|")

if Zangmen="" or isnull(Zangmen) then
ZangmenStr="<font color=#FF6666>- 竞选中 -</font>"
elseif Zangmen="-退出"&Mpmc&"-" then
ZangmenStr="<font color=#CC6666>弃帮跑路</font>"
else
if Zangmen=dvbbs.membername then CanManage=true
ZangmenStr="<a href=dispuser.asp?name="&dvbbs.HTMLEncode(Zangmen)&" title=""查看该"&Zmmc&"的资料"" target=_blank>"&Zangmen&"</a>"
end if
else
GroupName=""
Menpai_setting=split("-1|0|0|0|0|0|1|","|")
end if
rs.close
else
GroupName=""
Menpai_setting=split("-1|0|0|0|0|0|1|","|")
end if

dim wumenwupai'收纳不属于如何部落成员的部落
set rs=conn.execute("select GroupName from [Dv_GroupName] where state=1")  
if rs.eof and rs.bof then 
wumenwupai=Zlmp
else
wumenwupai=rs(0)
end if
rs.close

dim mymenpai'自己所在的部落
mymenpai=conn.execute("select UserGroup from [Dv_user] where username='"&dvbbs.membername&"'")(0) 

select case menu
case 1
call menpai()'显示部落的基本情况
case 2
call inmenpai()'加入部落
case 3  
    call exitmenpai()'退出部落 
    case 4  
call manage() '管理部落 － 修改部落资料页面 
case 5 
    call clearmember()'清理门户  
case 6  
   call changegroup()    '保存修改（部落管理）
case 7  
call applynewmenpai()'申请部落－写入数据库
case 8
    call newmenpai()'申请部落－界面 
case 9
    call logout()'注销部落
                        case 10
                        call setJob() 
case else
call menpai()
end select
end if
if Founderr then call menpai_err()
dvbbs.activeonline()
dvbbs.footer() 
'========================主程序结束===========================

'---------------------------显示部落资料----------------------
sub menpai()
if GroupName="" then 
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关"&Mpmc&""
Founderr=true
exit sub
end if 
dim TotalArticle,TotalWealth,TotalUsernum,CanJoinin,CanExitout
TotalArticle=0:TotalWealth=0:TotalUsernum=0
CanJoinin=true:CanExitout=false
'统计指定部落的文章数、金钱数 和 成员数（包括首脑） 
set rs=conn.execute("select sum(userpost),sum(userwealth),count(*) from [Dv_user] where usergroup='"&GroupName&"'") 
if rs(0)<>"" then TotalArticle=rs(0)
if rs(1)<>"" then TotalWealth=rs(1)
if rs(2)<>"" then TotalUsernum=rs(2)

dim yourmsg
%>
<table cellspacing=1 align=center class=tableborder1 >
<tr>
<th valign=middle align=center height=24 colspan=8 id=TableTitleLink><%=Mpmc%>资料 | <a href=menpaimember.asp?Groupname=<%=Groupname%>>查看本<%=Mpmc%>成员</a></th> 
</tr> 
<tr> 
<td valign=middle align=center class=tabletitle2 height="22"><%=Mpmc%>名称</td> 
<td valign=middle align=center class=tabletitle2 height="22"><%=Zmmc%></td> 
<td valign=middle align=center class=tabletitle2 height="22">性质</td> 
<td valign=middle align=center class=tabletitle2 height="22">创建日期</td>
<td valign=middle align=center class=tabletitle2 height="22">成员数</td>
<td valign=middle align=center class=tabletitle2 height="22">金钱数</td>
<td valign=middle align=center class=tabletitle2 height="22">文章数</td>
<td valign=middle align=center class=tabletitle2 height="22">当前状态</td>
</tr> 
<tr> 
<td valign=middle align=center class=tablebody1 height="20"><font color="#FF9933"><font face=Wingdings color=blue>[</font> <%=GroupName%></font></td>   
<td valign=middle align=center class=tablebody1 height="20"><%=ZangmenStr%></td>
<td valign=middle align=center class=tablebody1 height="20"><%=MenpaiAttri(Menpai_setting(0))%></td> 
<td valign=middle align=center class=tablebody1 height="20"><%=Addtime%></td>
<td valign=middle align=center class=tablebody1 height="20"><%=TotalUsernum%></td> 
<td valign=middle align=center class=tablebody1 height="20"><%=TotalWealth%></td> 
<td valign=middle align=center class=tablebody1 height="20"><%=TotalArticle%></td> 
<td valign=middle align=center class=tablebody1 height="20"><%=MenpaiState(States)%></td>
</tr> 
<tr><td height=8 class=tablebody2 colspan=8></td></tr>
<tr> 
<td valign=middle align=center class=tabletitle2 height="22"><%=Mpmc%>简介</td>  
<td valign=middle align=left class=tablebody1 height="22" colspan=7>&nbsp;<font face=Wingdings color=blue>v</font>&nbsp;<%=menpai_setting(7)%></td> 
</tr> 
<tr><td height=8 class=tablebody2 colspan=8></td></tr>
<tr> 
<td valign=middle align=center class=tabletitle2 height="22"><%=Mpmc%>内部规条</td>  
<td valign=middle align=left class=tablebody1 height="22" colspan=7><ui>
<%select case Menpai_setting(0)
case 0
response.Write "<li>本"&Mpmc&"是<u>"&Sl1&"</u>，您可以随意加入和退出本"&Mpmc
case 1
response.Write "<li>本"&Mpmc&"是<u>"&Sl2&"</u>，必须满足条件才能加入和退出本"&Mpmc
response.Write "<li>加入本"&Mpmc&"要花费一定的金钱，但是魅力，经验，威望等会增加"
response.Write "<li>退出本"&Mpmc&"要扣除几倍的入门费，并且要减一定的魅力，经验和威望"
case 2
response.Write "<li>本"&Mpmc&"是<u>"&Sl3&"</u>(在那些所谓的"&Sl1&"眼里)，必须满足条件才能加入和退出本"&Mpmc
response.Write "<li>加入本"&Mpmc&"您的金钱会增加，但是会减一定的魅力，经验和威望；退出时反之"
case 3
response.Write "<li><u>"&Sl4&"</u>，不属于任何"&Mpmc&"，群蛇混杂，什么人都有"
end select 
if cint(Menpai_setting(0))<>3 then
response.Write "<li>"&Zmmc&"有权将不遵守规条的人踢出本"&Mpmc&"，被踢出"&Mpmc&"的用户会自动加入<u>"&Sl4&"</u>"
end if
%>
</ui></td> 
</tr> 
<tr><td height=15 class=tablebody2 colspan=8></td></tr>
<th height="22" colspan=8>加入本门<%=Mpmc%>条件</th>
<tr>
<td align=center height=21 width="15%" class=tabletitle2>项目</td> 
<td align=center height=21 class=tabletitle2>金钱</td> 
<td align=center height=21 class=tabletitle2>经验</td>
<td align=center height=21 class=tabletitle2>魅力</td> 
<td align=center height=21 class=tabletitle2>威望</td>
<td align=center height=21 class=tabletitle2>文章</td> 
<td align=center height=21 class=tablebody2></td>
<td align=center height=21 class=tablebody2><%=Mpmc%></td>
</tr>
<tr>
<td align=center height=21 class=tablebody2>加入<%=Mpmc%>要求</td>
<td align=center height=21 class=tablebody1><%=menpai_setting(1)%></td>
<td align=center height=21 class=tablebody1><%=menpai_setting(2)%></td>
<td align=center height=21 class=tablebody1><%=menpai_setting(3)%></td>
<td align=center height=21 class=tablebody1><%=menpai_setting(4)%></td>
<td align=center height=21 class=tablebody1><%=menpai_setting(5)%></td>
<td align=center height=21 class=tablebody1></td>
<td align=center height=21 class=tablebody1><%=wumenwupai%></td>
</tr>
<tr>

<td align=center height=21 class=tablebody2>您的条件</td>
    <td align=center height=21 class=tablebody1><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text%></td>
<td align=center height=21 class=tablebody1><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text%></td>
<td align=center height=21 class=tablebody1><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text%></td>
<td align=center height=21 class=tablebody1><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text%></td>
<td align=center height=21 class=tablebody1><%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text%></td>
<td align=center height=21 class=tablebody1></td>
<td align=center height=21 class=tablebody1><%=mymenpai%></td>
</tr>
<tr>
<td align=center height=21 class=tablebody2>是否满足</td>
<td align=center height=21 class=tablebody1><%if int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text )>=int(menpai_setting(1))   then%><font color=blue>√</font><%else%><%CanJoinin=false%><font color=red>×</font><%end if%></td>
<td align=center height=21 class=tablebody1><%if int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text)>=int(menpai_setting(2))  then%><font color=blue>√</font><%else%><%CanJoinin=false%><font color=red>×</font><%end if%></td>
<td align=center height=21 class=tablebody1><%if int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text)>=int(menpai_setting(3))  then%><font color=blue>√</font><%else%><%CanJoinin=false%><font color=red>×</font><%end if%></td>
<td align=center height=21 class=tablebody1><%if int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text)>=int(menpai_setting(4))   then%><font color=blue>√</font><%else%><%CanJoinin=false%><font color=red>×</font><%end if%></td>
<td align=center height=21 class=tablebody1><%if int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text)>=int(menpai_setting(5)) then%><font color=blue>√</font><%else%><%CanJoinin=false%><font color=red>×</font><%end if%></td>
<td align=center height=21 class=tablebody1></td>
<td align=center height=21 class=tablebody1><%if mymenpai=wumenwupai then%><font color=blue>√</font><%else%><%CanJoinin=false%><font color=red>×</font><%end if%></td>
</tr>
<tr><td height=8 class=tablebody2 colspan=8></td></tr>
  <tr> 
    <td valign=middle align=center class=tablebody2 height="22">加入本<%=Mpmc%>后</td> 
    <td valign=middle align=center class=tablebody1 colspan=3><font color=navy> 
<%
if cint(Menpai_setting(0))=0 then '加入 明门正派 
    response.write "您的金钱-0，经验+0，魅力+0，威望+0"                       
elseif cint(Menpai_setting(0))=1 then'加入 社团 
    response.write "您的金钱-"&int(Menpai_setting(1)*Meipai_inout_rate(0))&"，经验+"&int(menpai_setting(2)*Meipai_inout_rate(1))&"，魅力+"&int(Menpai_setting(3)*Meipai_inout_rate(2))&"，威望+"&int(Menpai_setting(4)*Meipai_inout_rate(3))&""
  elseif cint(Menpai_setting(0))=2 then'加入 激进部落 
    response.write "您的金钱+"&int(Menpai_setting(1)*Meipai_inout_rate(4))&"，经验-"&int(menpai_setting(2)*Meipai_inout_rate(5))&"，魅力-"&int(Menpai_setting(3)*Meipai_inout_rate(6))&"，威望-"&int(Menpai_setting(4)*Meipai_inout_rate(7))&""
else
response.write "您的金钱-0，经验+0，魅力+0，威望+0"
end if
%>                           
  </font></td>
  <td valign=middle align=center class=tablebody2 height="22" colspan=2>您的状态</td> 
  <td valign=middle align=center class=tablebody1 height="22" colspan=2>
<%
if mymenpai=wumenwupai then
response.write "<font color=red>您还没有加入任何"&Mpmc&"</font> "
elseif mymenpai<>Groupname then
response.write mymenpai &"成员"
CanJoinin=false
elseif CanManage then
response.write "本"&Mpmc&Zmmc
CanJoinin=false
else
response.write "本"&Mpmc&"成员"
CanJoinin=false
CanExitout=true
end if
%>
  </td>                          
  </tr> 
  <tr> 
    <td valign=middle align=center class=tablebody2 height="22">退出本<%=Mpmc%>后</td> 
    <td valign=middle align=center class=tablebody1 colspan=3><font color=navy> 
<%
if cint(Menpai_setting(0))=0 then '退出 明门正派
    response.write "您的金钱-0，经验+0，魅力+0，威望+0"                       
elseif cint(Menpai_setting(0))=1 then'退出 社团
    response.write "您的金钱-"&int(Menpai_setting(1)*Meipai_inout_rate(8))&"，经验-"&int(menpai_setting(2)*Meipai_inout_rate(9))&"，魅力-"&int(Menpai_setting(3)*Meipai_inout_rate(10))&"，威望-"&int(Menpai_setting(4)*Meipai_inout_rate(11))&""
  elseif cint(Menpai_setting(0))=2 then'退出 激进部落
    response.write "您的金钱-"&int(Menpai_setting(1)*Meipai_inout_rate(12))&"，经验+"&int(menpai_setting(2)*Meipai_inout_rate(13))&"，魅力+"&int(Menpai_setting(3)*Meipai_inout_rate(14))&"，威望+"&int(Menpai_setting(4)*Meipai_inout_rate(15))&""
else
response.write "您的金钱-0，经验+0，魅力+0，威望+0"
end if
%>                           
  </font></td>
  <td valign=middle align=center class=tablebody2 height="22" colspan=2>您的操作</td> 
  <td valign=middle align=center class=tablebody1 height="22" colspan=2>
<%
if CanExitout then
yourmsg="<font color=red>热烈欢迎本"&Mpmc&"成员"&dvbbs.membername&" 回来</font>"                            
response.Write "<a href=""menpaiadd.asp?menu=3&groupname="&dvbbs.HTMLEncode(groupname)&""" onclick=""{if(confirm('您确定退出 "&groupname&" 吗?')){this.document.form1.submit();return true;}return false;}""><font color=blue>退出本"&Mpmc&"</font></a> | <a href=menpai.asp><font color=blue>"&Mpmc&"首页</font></a>"  
end if
                                                                                                                                                                                                  
if CanManage then                                                                                                                                                                                                                                  
yourmsg="<font color=red>欢迎"&Zmmc&"大驾光临</font>"
response.Write "<a href=""menpaiadd.asp?menu=4&groupname="&dvbbs.HTMLEncode(groupname)&"""><font color=blue>管理本"&Mpmc&"</font></a> | <a href=menpai.asp><font color=blue>"&Mpmc&"首页</font></a>"
end if                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                  
if (not Canjoinin) and (not CanExitout) and (not CanManage) then
if isZangmen then
yourmsg="<font color=red>热烈欢迎 "&mymenpai&Zmmc&dvbbs.membername&" 光临本"&Mpmc&"</font>" 
elseif mymenpai<>wumenwupai then
yourmsg="<font color=red>热烈欢迎 "&mymenpai&" 成员 "&dvbbs.membername&" 光临本"&Mpmc&"</font>"
else
yourmsg="<font color=red>您至少有一项条件不满足，暂时不能加入本"&Mpmc&"</font>"  
end if
response.Write "<a href=""menpaiadd.asp?menu=2&groupname="&dvbbs.HTMLEncode(groupname)&""" onclick=""{if(confirm('您确定加入 "&groupname&" 吗?')){return true;}return false;}""><font color=blue>加入本"&Mpmc&"</font></a> | <a href=menpai.asp><font color=blue>"&Mpmc&"首页</font></a>"
elseif Canjoinin and (not CanManage) then
if Groupname=wumenwupai then
response.Write "<a href=menpai.asp><font color=blue>"&Mpmc&"首页</font></a>"
yourmsg="<font color=red>形式不容乐观，处处要小心哦</font>"
else
yourmsg="<font color=red>欢迎流浪者 "&dvbbs.membername&" 光临 "&Groupname&"，欢迎您加入本"&Mpmc&"</font>"
response.Write "<a href=""menpaiadd.asp?menu=2&groupname="&dvbbs.HTMLEncode(groupname)&""" onclick=""{if(confirm('您确定加入 "&groupname&" 吗?')){return true;}return false;}""><font color=blue>加入本"&Mpmc&"</font></a> | <a href=menpai.asp><font color=blue>"&Mpmc&"首页</font></a>"
end if
end if                                                                                                                                                                                                                                 
%>                                                                                                                                                                                                                                   
  </td>                          
  </tr>                                
  <tr>                                
    <td valign=middle align=center height=22 class=tablebody1 colspan=8><%=yourmsg%></td>                                                                                                                                                                                                                                   
  </tr>                                                                                                                                                                                                                                   
</table>                                                                                                                                                                                                                                   
<%                                                                                                                                                                                                                                   
end sub                                                                                                                                                                                                                                  
'-------------------------加入部落----------------------------
sub inmenpai()                                                                                                                                                                                                                                   

if Groupname="" then 
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关"&Mpmc&""
Founderr=true
exit sub
end if 
if mymenpai<>wumenwupai then
Errmsg=Errmsg+"<br>"+"<li>您已经是另一个"&Mpmc&"的成员了，要加入本"&Mpmc&"请先退出原来的"&Mpmc&""
Founderr=true
exit sub
elseif int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text)<int(menpai_setting(1)) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text)<int(menpai_setting(2)) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text)<int(menpai_setting(3)) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text)<int(menpai_setting(4)) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text)<int(menpai_setting(5)) then
Errmsg=Errmsg+"<br>"+"<li>您至少有一个条件不满足加入本"&Mpmc&"的要求"
Founderr=true
exit sub
end if 
                                                                                                                                                                                                                              
    Set rs= Server.CreateObject("ADODB.Recordset")                                                                                                                                                                                                                           
sql="select usergroup,userwealth,userep,usercp,userpower from [Dv_user] where username='"&dvbbs.membername&"'"                                                                                                                                                                                                                                   
rs.open sql,conn,1,3                                                                                                                                                                                                                                  
if rs.eof and rs.bof then
Errmsg=Errmsg+"<br>"+"<li>您怎么会跑到这里来了"
Founderr=true
exit sub
else
sucmsg=sucmsg+"<br>"+"<li>您成功加入了 "&groupname
if cint(menpai_setting(0))=0 then       '名门正派 
rs(0)=Groupname
rs.update
sucmsg=sucmsg+"<br>"+"<li>您的金钱-0，经验+0，魅力+0，威望+0"
elseif cint(menpai_setting(0))=1 then       '社团
rs(0)=Groupname
rs(1)=rs(1)-int(menpai_setting(1)*Meipai_inout_rate(0))
rs(2)=rs(2)+int(menpai_setting(2)*Meipai_inout_rate(1))
rs(3)=rs(3)+int(menpai_setting(3)*Meipai_inout_rate(2))
rs(4)=rs(4)+int(menpai_setting(4)*Meipai_inout_rate(3))
rs.update
sucmsg=sucmsg+"<br>"+"<li>您的金钱-"&int(Menpai_setting(1)*Meipai_inout_rate(0))&"，经验+"&int(menpai_setting(2)*Meipai_inout_rate(1))&"，魅力+"&int(Menpai_setting(3)*Meipai_inout_rate(2))&"，威望+"&int(Menpai_setting(4)*Meipai_inout_rate(3))
elseif cint(menpai_setting(0))=2 then       '激进部落           
rs(0)=Groupname
rs(1)=rs(1)+int(menpai_setting(1)*Meipai_inout_rate(4))        
rs(2)=rs(2)-int(menpai_setting(2)*Meipai_inout_rate(5))   
rs(3)=rs(3)-int(menpai_setting(3)*Meipai_inout_rate(6))
rs(4)=rs(4)-int(menpai_setting(4)*Meipai_inout_rate(7))
rs.update
sucmsg=sucmsg+"<br>"+"<li>您的金钱+"&int(Menpai_setting(1)*Meipai_inout_rate(4))&"，经验-"&int(menpai_setting(2)*Meipai_inout_rate(5))&"，魅力-"&int(Menpai_setting(3)*Meipai_inout_rate(6))&"，威望-"&int(Menpai_setting(4)*Meipai_inout_rate(7))&""
elseif cint(menpai_setting(0))=3 then
rs(0)=Groupname
rs.update
sucmsg=sucmsg+"<br>"+"<li>您的金钱-0，经验+0，魅力+0，威望+0"
                else
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关的"&Mpmc&"属性参数"
Founderr=true
exit sub
end if
end if

call menpai_suc()
end sub                                                                                                                                                                                                                                      
'---------------------------退出部落------------------------------
sub exitmenpai()                                                                                                                                                                                                                                   

if Groupname="" then 
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关"&Mpmc&""
Founderr=true
exit sub
end if

if cint(Menpai_setting(0))=0 then 

elseif cint(Menpai_setting(0))=1 then 
if int(menpai_setting(2)*Meipai_inout_rate(9))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text or int(Menpai_setting(3)*Meipai_inout_rate(10))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text or int(Menpai_setting(4)*Meipai_inout_rate(11))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text then                                                                                                                                                                                                      
Errmsg=Errmsg+"<br>"+"<li>您还没有足够的资本脱离本"&Mpmc&""
Founderr=true
end if
elseif cint(Menpai_setting(0))=2 then
if int(Menpai_setting(1)*Meipai_inout_rate(12))>Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text then
Errmsg=Errmsg+"<br>"+"<li>您还没有足够的资本脱离本"&Mpmc&""
end if
else
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关"&Mpmc&"属性"
Founderr=true
end if

if Founderr then exit sub

Groupname=wumenwupai  
                                                                                                                                                                                                                   
Set rs= Server.CreateObject("ADODB.Recordset")                                                                                                                                                                                                                                   
sql="select usergroup,userwealth,userep,usercp,userpower from [Dv_user] where username='"&dvbbs.membername&"'"                                                                                                                                                                                                                                   
rs.open sql,conn,1,3                                                                                                                                                                                                                                  
                                                                                                                                                                                                                   
if cint(Menpai_setting(0))=0 then   '名门正派                                                                                                                                                                                                                        
rs("usergroup")=groupname                                                                                                                                                                                                                           
rs.update     
sucmsg=sucmsg+"<br>"+"<li>您的金钱+0，经验-0，魅力-0，威望-0"                                                                                                                                                                                                                      
elseif cint(Menpai_setting(0))=1 then     '社团                                                                                                                                                                                                                              
rs(0)=Groupname
rs(1)=rs(1)-int(menpai_setting(1)*Meipai_inout_rate(8))
rs(2)=rs(2)-int(menpai_setting(2)*Meipai_inout_rate(9))
rs(3)=rs(3)-int(menpai_setting(3)*Meipai_inout_rate(10))
rs(4)=rs(4)-int(menpai_setting(4)*Meipai_inout_rate(11))                                                                                                                                                                                                                         
rs.update 
sucmsg=sucmsg+"<br>"+"<li>您的金钱+"&int(Menpai_setting(1)*Meipai_inout_rate(8))&"，经验-"&int(menpai_setting(2)*Meipai_inout_rate(9))&"，魅力-"&int(Menpai_setting(3)*Meipai_inout_rate(10))&"，威望-"&int(Menpai_setting(4)*Meipai_inout_rate(11))&""                                                                                                                                                                                                                         
elseif cint(Menpai_setting(0))=2 then   '激进部落
rs(0)=Groupname
rs(1)=rs(1)-int(menpai_setting(1)*Meipai_inout_rate(12))        
rs(2)=rs(2)+int(menpai_setting(2)*Meipai_inout_rate(13))   
rs(3)=rs(3)+int(menpai_setting(3)*Meipai_inout_rate(14))
rs(4)=rs(4)+int(menpai_setting(4)*Meipai_inout_rate(15))                                                                                                                                                                                                                         
rs.update  
sucmsg=sucmsg+"<br>"+"<li>您的金钱-"&int(Menpai_setting(1)*Meipai_inout_rate(12))&"，经验+"&int(menpai_setting(2)*Meipai_inout_rate(13))&"，魅力+"&int(Menpai_setting(3)*Meipai_inout_rate(14))&"，威望+"&int(Menpai_setting(4)*Meipai_inout_rate(15))&""                                                                                                                                                                                                                        
end if  
rs.close
set rs=nothing                                                                                                                                                                                                                        
call menpai_suc()                                                                                                                                                                                                                                
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 not CanManage then
Errmsg=Errmsg+"<br>"+"<li>您不是本"&Mpmc&""&Zmmc&"，没有管理本"&Mpmc&"的权限"
Founderr=true
exit sub
end if
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>您输入的用户不是本"&Mpmc&"成员"
Founderr=true
exit sub                                                                                            
else
rs("Menpai_Job")=menpai_Job
rs.update                                                                                             
end if                                                                                                                                                                                            
rs.close                                                                                             
set rs=nothing   
call menpai_suc()   
end sub                                                                                                                                                                                                                                  
'---------------------------部落管理====管理页面------------------------------
sub manage()                                                                                                                                                                                           
if not CanManage then
Errmsg=Errmsg+"<br>"+"<li>您不是本"&Mpmc&""&Zmmc&"，没有管理本"&Mpmc&"的权限"
Founderr=true
exit sub
end if
if Groupname="" then 
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关"&Mpmc&"参数"
Founderr=true
exit sub
end if 

%>   
<table cellspacing=1 align=center class=tableborder1 >                                                                                                                                                                              
  <tr>                                                                                                                                                                                           
    <td valign=middle align=center height=24 class=tablebody2 colspan="4"><%=Mpmc%>管理</td>                                                                                                                                                                                          
  </tr> 
<form name="form" method="post" action="menpaiadd.asp?menu=6">                                                                                                                                                                                            
  <tr>                                                                                                                                                                                           
    <th valign=middle align=left height=24 colspan="4">&nbsp;★&nbsp; <%=Mpmc%>基本设置</th>                                                                                                                                                                                          
  </tr> 
<tr><td height=8 class=tablebody2 colspan="4"></td></tr>                                                                                                                                                                                        
    <tr>                                                                                                                                                                                          
<td valign=middle align=left class=tablebody2 height="22"><b><%=Zmmc%>须知:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody1 height="22" colspan="3">
 <li><font color="#FF9966">欢迎 <font color=blue><%=Groupname%></font> <%=Zmmc%> <font color=red><%=dvbbs.membername%></font> 进入<%=Mpmc%>管理</font>
<li><%=Mpmc%>的最终解释权属于管理员
<li>如果<%=Zmmc%>不负责任，管理员有权撤消其职务 
<li>下面是您所管理的<%=Mpmc%>的基本情况
</td> 
  </tr>    
<tr><td height=8 class=tablebody2 colspan="4"></td></tr> 
  <tr> 
<td valign=middle align=left class=tablebody2 height="22"><b><%=Mpmc%>名称:</b><br> <%=Mpmc%>名称申请之后<%=Zmmc%>不能修改</td> 
<td valign=middle align=left class=tablebody1 height="22" colspan="3">&nbsp;<INPUT name=newGroupName size="20" maxlength="20" disabled value=<%=GroupName%>> <font color=red>*</font> (不要超过12个英文字母或6个汉字)<INPUT name=GroupName size="20" maxlength="20" type=hidden value=<%=GroupName%>></td>
  </tr>
  <tr> 
<td valign=middle align=left class=tablebody2 height="22"><b><%=Mpmc%>性质:</b><br> <%=Mpmc%>性质申请之后<%=Zmmc%>不能修改</td>
<td valign=middle align=left class=tablebody1 height="22" colspan="3">
<input type=radio name=newMenpaiAttri value=0 disabled <%if cint(menpai_setting(0))=0 then%>checked<%end if%>><%=Sl1%>
<input type=radio name=newMenpaiAttri value=1 disabled <%if cint(menpai_setting(0))=1 then%>checked<%end if%>><%=Sl2%>
<input type=radio name=newMenpaiAttri value=2 disabled <%if cint(menpai_setting(0))=2 then%>checked<%end if%>><%=Sl3%>
<input type=hidden name=MenpaiAttri value=<%=cint(menpai_setting(0))%>>
</td>
  </tr>
<tr><td height=8 class=tablebody2 colspan="4"></td></tr>
    <tr>
<td valign=middle align=left class=tablebody2 height="22"><b>说明:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody1 height="22" colspan="3">
 <li>金钱,魅力,经验,威望,文章数,用户等级 都不能超过您自已的当前值
<li>金钱,魅力,经验,威望,文章数,用户等级 是加入<%=Mpmc%>的必须满足的最小值
<li>金钱,魅力,经验,威望,文章数,用户等级 也是加入和退出<%=Mpmc%>增加/扣除相关值时的基数
<li><%=Sl1%>不受以上限制
<li><%=Zmmc%>可以根据实际情况修改下面各项，修改好之后 提交 即可
</td> 
  </tr> 
    <tr>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody2 height="22" width="25%"><b>金钱:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userwealth value=<%=menpai_setting(1)%> <%if cint(menpai_setting(0))=0 then%> disabled<%end if%>></td>                                                                                                                                                                                        
<td valign=middle align=right class=tablebody2 height="22">您的金钱:&nbsp;</td>
<td valign=middle align=left class=tablebody1 height="22" width="20%">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text%></td>
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>经验:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userep value=<%=menpai_setting(2)%> <%if cint(menpai_setting(0))=0 then%> disabled<%end if%>></td>
<td valign=middle align=right class=tablebody2 height="22">您的经验:&nbsp;</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text %></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>魅力:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=usercp value=<%=menpai_setting(3)%> <%if cint(menpai_setting(0))=0 then%> disabled<%end if%>></td> 
<td valign=middle align=right class=tablebody2 height="22">您的魅力:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>威望:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userpower value=<%=menpai_setting(4)%> <%if cint(menpai_setting(0))=0 then%> disabled<%end if%>></td> 
<td valign=middle align=right class=tablebody2 height="22">您的威望:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>文章数:</b><br>加入本<%=Mpmc%>必须达到的发贴数</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userarticle value=<%=menpai_setting(5)%> <%if cint(menpai_setting(0))=0 then%> disabled<%end if%>></td> 
<td valign=middle align=right class=tablebody2 height="22">您的贴数:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>用户等级:</b><br>加入本<%=Mpmc%>必须具备的等级(1～<%=maxtitleid%>)</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userclass value=<%=menpai_setting(6)%> <%if cint(menpai_setting(0))=0 then%> disabled<%end if%>>&nbsp;<%=GetUserTitle(Menpai_setting(6))%>(<%=Menpai_setting(6)%>级)</td> 
<td valign=middle align=right class=tablebody2 height="22">您的等级:&nbsp;</td>                                                                                                                                                                                     
<td valign=middle align=left class=tablebody1 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=tablebody1 height=22 colspan="4"><font color="#CC9933">
如果<%=Mpmc%>性质是<%=Sl1%>，则以上6项(金钱,魅力,经验,威望,文章数,用户等级)不必填写</font>
</td>
</tr> 
<tr><td height=8 class=tablebody2 colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>本<%=Mpmc%>简介:</b><br>对您的<%=Mpmc%>作简单的介绍，在您的<%=Mpmc%>资料中会显示出来</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 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=tablebody2 colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                       
    <td valign=middle align=center class=tablebody1 colspan="4" height="22"><INPUT type=submit value=更新 name=submit></td>                                                                                                                                                                                       
  </tr>                                                                                                                                                                              
  </form>                                                                                                                                                                                    
    <tr><td height=15 class=tablebody2 colspan="4"></td></tr>                                                                                                                                                                                                   
<form name="form1" method="post" action="menpaimember.asp">                                                                                                                                                                               
<INPUT name=Groupname size="20" value="<%=groupname%>" type=hidden>                                                                                                                                                                          
<tr>                                                                                                                                                                                         
<th valign=middle align=left height=24 colspan="4" >&nbsp;◆&nbsp;<b><%=Mpmc%>人员快捷管理</b></th>                                                                                                                                                                                         
</tr>                                                                                                                                                                               
<tr>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody2 height="22"><b>本<%=Mpmc%>成员</b><br>请输入本<%=Mpmc%>成员的用户名</td>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody1 colspan="3">
&nbsp;<INPUT name=Susername type=text>&nbsp;&nbsp;
<INPUT type=submit value=查找 name=action>&nbsp;&nbsp;
<INPUT type=checkbox value=1 name=search checked>完全匹配用户名&nbsp;&nbsp;
<INPUT type=submit value=成员列表 name=action>&nbsp;&nbsp;
</tr>
</form>

<form name="form3" method="post" action="menpaiadd.asp?menu=5">                                                                                                                                                                               
<INPUT name=Groupname size="20" value="<%=groupname%>" type=hidden> 
  <tr>                                                                                                                                                                                       
    <td valign=middle align=left class=tablebody2 height="22"><b>清理门户</b><br>请输入您想踢出本<%=Mpmc%>的用户名</td>
    <td valign=middle align=left class=tablebody1 colspan="3">&nbsp;<INPUT name=Tusername type=text>&nbsp;&nbsp;                                                                                                                                                                        
      <INPUT type=submit value=清理 name=submit onclick="{if(confirm('您确定执行踢人操作吗?')){this.document.form3.submit();return true;}return false;}">
</td>                                                                                                                                                                                         
  </tr>                                                                                                                                                                       
  </form>  
  <tr><td height=8 class=tablebody2 colspan="4"></td></tr>                                                                                                                                                                    
<tr>                                                                                                                                                                                           
<th valign=middle align=left height=24 colspan="4">&nbsp;■&nbsp;注销本<%=Mpmc%></th>                                                                                                                                                                                          
</tr>                                                                                                                                                                                 
  <form name="form2" method="post" action="menpaiadd.asp?menu=9">                                                                                                                     
  <INPUT name=Groupname size="20" value="<%=Groupname%>" type=hidden>                                                                                                                                                                     
<tr>  
<td valign=middle align=left class=tablebody2 height="22" colspan="2"><b>注销本<%=Mpmc%></b><br>该操作将会删除该<%=Mpmc%>，请考虑清楚后进行操作</td>
<td valign=middle align=center class=tablebody1 colspan="2">
  <INPUT type=submit value=注销 name=submit onclick="{if(confirm('您确定要注销本<%=Mpmc%>吗?')){this.document.form2.submit();return true;}return false;}">                                                                                                                                                                  
</td>                                                                                                                                                                                          
</tr>
<tr>                                                                                                                                                                                         
<th valign=middle align=left height=24 colspan="4" >&nbsp;◆&nbsp;<b><%=Mpmc%>职位设置</b></th>                                                                                                                                                                                         
</tr>                                                                                                                                                                    
  </form>
        <tr>
        <form name="form99" method="post" action="menpaiadd.asp?menu=10">
        <INPUT name=Groupname size="20" value="<%=groupname%>" type=hidden> 
        <td valign=middle align=left class=tablebody2 height="22">
         <b>成员名称:</b></td><td valign=middle align=left class=tablebody1 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=tablebody1 colspan="3"><INPUT name=Jobname size="20"></td>
        </tr><tr><td valign=middle align=center class=tablebody1 colspan="4" height="22"><INPUT type=submit value=更新 name=submit></td>
        </form></tr>                                                                                                                                                                                              
 </table>                                                                                                                                                                                            
<%                                                                                                                                                                                                                             
end sub                                                                                                                                                                                                                             
'----------------------------------清理门户-----------------------------------
sub clearmember()   
if not CanManage then
Errmsg=Errmsg+"<br>"+"<li>您不是本"&Mpmc&""&Zmmc&"，没有管理本"&Mpmc&"的权限"
Founderr=true
exit sub
end if
                                                                                                                                                                                            
dim Tusername                                                                                                                                                                                                                                   
Groupname=dvbbs.checkStr(trim(Request.form("Groupname")))
Tusername=dvbbs.checkStr(trim(Request.form("Tusername")))

if Groupname="" or isnull(Groupname) then
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关"&Mpmc&"参数"
Founderr=true
end if
if Tusername="" or isnull(Tusername) then
Errmsg=Errmsg+"<br>"+"<li>请输入您想踢出本"&Mpmc&"的用户名"
Founderr=true
end if
if Founderr then exit sub

Set rs= Server.CreateObject("ADODB.Recordset")                                                                                                                                                                                                                                   
sql="select * from [Dv_user] where username='"&Tusername&"'"                                                                                                                                                                                                                                   
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>您输入的用户不是本"&Mpmc&"成员"
Founderr=true
exit sub                                                                                            
else                                                                                             
rs("usergroup")=wumenwupai
rs.update                                                                                             
end if                                                                                                                                                                                            
rs.close                                                                                             
set rs=nothing  

call sendmessage(Tusername,Groupname) '发送清理短信息给用户
Sucmsg=Sucmsg+"<br>"+"<li>您已经成功把[<font color=red>"&Tusername&"</font>]清理出本"&Mpmc&""
Sucmsg=Sucmsg+"<br>"+"<li>已经发送了清理通知给该用户"  
call menpai_suc()                                                                                                                                                                                                                          
end sub                                                                                                                                                                                                                             
'-------------------------------保存部落资料的修改---------------------------
sub changegroup()  
if not CanManage then
Errmsg=Errmsg+"<br>"+"<li>您不是本"&Mpmc&""&Zmmc&"，没有管理本"&Mpmc&"的权限"
Founderr=true
exit sub
end if
                                                                                                                                                   
dim MenpaiAttri,userwealth,usercp,userep,userpower,userclass,userartitle
'GroupName=dvbbs.checkStr(trim(Request.form("GroupName")))
'newGroupName=dvbbs.checkStr(trim(Request.form("newGroupName")))
GroupName=dvbbs.checkStr(trim(Request.form("GroupName")))
MenpaiAttri=Request.form("MenpaiAttri")'MenpaiAttri=Request.form("newMenpaiAttri")

if GroupName="" then'保留这个功能
Errmsg=Errmsg+"<br>"+"<li>请输入"&Mpmc&"名称"
Founderr=true
elseif strLength(GroupName)>12 then
Errmsg=Errmsg+"<br>"+"<li>"&Mpmc&"名称不能超过12个英文字母(6个汉字)"
Founderr=true
end if
if cint(MenpaiAttri)<>0 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/@userep").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/@usercp").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"))<9 and int(Request.form("userclass"))<GetUserGroupID(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text) 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>"&Mpmc&"简介不能超过100个英文或50个汉字"
Founderr=true
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 rs.bof and rs.eof then   '该功能以后扩展可以修改名字是用                                                                            
Errmsg=Errmsg+"<br>"+"<li>该"&Mpmc&"不存在啊"
Founderr=true
rs.close
set rs=nothing
exit sub
else                                  
'rs("Groupname")=GroupName
rs("Menpai_setting")=MenpaiAttri & "|" & userwealth & "|" & userep & "|" & usercp & "|" & userpower & "|" & userartitle & "|" & userclass & "|" & menpaireadme
rs.update  
'conn.execute("update [Dv_user] set usergroup='"&GroupName&"',userwealth=userwealth-"&new_menpai_setting(6)&" where username='"&dvbbs.membername&"'")                                            
end if
Sucmsg=Sucmsg+"<br>"+"<li>"&Mpmc&"资料修改成功"  
call menpai_suc()
end sub                                                                                                                                                                                                                             
'----------------------------注销部落-------------------------------
sub logout()
                                                                                              
if not CanManage then
Errmsg=Errmsg+"<br>"+"<li>您不是本"&Mpmc&""&Zmmc&"，没有管理本"&Mpmc&"的权限"
Founderr=true
exit sub
end if
if Groupname="" then 
Errmsg=Errmsg+"<br>"+"<li>错误的"&Mpmc&"参数，请指定相关"&Mpmc&"参数"
Founderr=true
exit sub
elseif Groupname=wumenwupai then
Errmsg=Errmsg+"<br>"+"<li>本"&Mpmc&"是收留所有尚未加入的人的特殊"&Mpmc&"，不可注销"
Founderr=true
exit sub
end if
                                                                                  
    conn.execute("update [Dv_GroupName] set state=2,Zangmen='-弃帮跑路-' where GroupName='"&GroupName&"'")
conn.execute("update [Dv_user] set usergroup='"&wumenwupai&"' where usergroup='"&GroupName&"'")

Sucmsg=Sucmsg+"<br>"+"<li>您已经注销了本"&Mpmc&""  
call menpai_suc()
end sub                                                                                                                                                                                                                             
'-----------------------------申请部落==界面------------------------------
sub newmenpai()       
if isZangmen then
Errmsg=Errmsg+"<br>"+"<li>您已经是 "&Groupname&Zmmc&" ，怎么还来创建部落呢"
Founderr=true
exit sub
end if
if mymenpai<>wumenwupai then
Errmsg=Errmsg+"<br>"+"<li>您已经是 "&Groupname&" 成员，不能创建新"&Mpmc&""
Founderr=true
exit sub
end if

dim new_menpai_setting
new_menpai_setting=split(conn.execute("select new_menpai_setting from [menpai]")(0),",")

if int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text)<(int(new_menpai_setting(0))+int(new_menpai_setting(6))) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text)<int(new_menpai_setting(1)) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text)<int(new_menpai_setting(2)) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text)<int(new_menpai_setting(3)) or int(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text)<int(new_menpai_setting(4)) or int(GetUserGroupID(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text))<int(new_menpai_setting(5)) then
Errmsg=Errmsg+"<br>"+"<li>您至少有一个条件不满足创建部落要求"
Founderr=true
exit sub
end if
%>                                                                                             
<table cellspacing=1 align=center class=tableborder1>                                                                                                                                                                              
<form name="form" method="post" action="menpaiadd.asp?menu=7">                                                                                                                                                                                            
  <tr>                                                                                                                                                                                           
    <th valign=middle align=center height=24 colspan="4">新<%=Mpmc%>申请</th>                                                                                                                                                                                          
  </tr> 
<tr><td height=8 class=tablebody2 colspan="4"></td></tr>                                                                                                                                                                                        
    <tr>                                                                                                                                                                                          
<td valign=middle align=left class=tablebody2 height="22"><b>创建部落须知:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody1 height="22" colspan="3">
 <li>恭喜您，您具备了创建<%=Mpmc%>的条件 
<li><%=Mpmc%>创建成功之后，等待管理员的审核，审核通过之后，本<%=Mpmc%>正式成立 
<li><%=Mpmc%>正式成立之后，您将会是本<%=Mpmc%>的<%=Zmmc%> 
<li>如果<%=Zmmc%>不负责任，管理员有权撤消其<%=Zmmc%>的职务 
<li>创建部落费用<font color=red><%=new_menpai_setting(6)%></font>元  
<li>请认真填写下面的<%=Mpmc%>资料
</td> 
  </tr>    
<tr><td height=8 class=tablebody2 colspan="4"></td></tr> 
  <tr> 
<td valign=middle align=left class=tablebody2 height="22"><b><%=Mpmc%>名称:</b><br> <%=Mpmc%>名称申请之后<%=Zmmc%>不能修改</td> 
<td valign=middle align=left class=tablebody1 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=tablebody2 height="22"><b><%=Mpmc%>性质:</b><br> <%=Mpmc%>性质申请之后<%=Zmmc%>不能修改</td>
<td valign=middle align=left class=tablebody1 height="22" colspan="3">
<input type=radio name=menpaiattri value=0 checked><%=Sl1%>
<input type=radio name=menpaiattri value=1><%=Sl2%>
<input type=radio name=menpaiattri value=2><%=Sl3%><br>
</td>
  </tr>
<tr><td height=8 class=tablebody2 colspan="4"></td></tr>
    <tr>
<td valign=middle align=left class=tablebody2 height="22"><b>说明:</b></td>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody1 height="22" colspan="3">
 <li>金钱,魅力,经验,威望,文章数,用户等级 都不能超过您自已的当前值
<li>金钱,魅力,经验,威望,文章数,用户等级 是加入本<%=Mpmc%>的必须满足的最小值
<li>金钱,魅力,经验,威望,文章数,用户等级 也是加入和退出<%=Mpmc%>增加/扣除相关值时的基数
<li><%=Sl1%>不受以上限制
<li>以下属性<%=Zmmc%>可以在<%=Mpmc%>管理中修改
</td> 
  </tr> 
    <tr>                                                                                                                                                                                         
<td valign=middle align=left class=tablebody2 height="22" width="25%"><b>金钱:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userwealth value=""></td>                                                                                                                                                                                        
<td valign=middle align=right class=tablebody2 height="22">您的金钱:&nbsp;</td>
<td valign=middle align=left class=tablebody1 height="22" width="20%">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text%></td>
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>经验:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userep value=""></td>
<td valign=middle align=right class=tablebody2 height="22">您的经验:&nbsp;</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userep").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>魅力:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=usercp value=""></td> 
<td valign=middle align=right class=tablebody2 height="22">您的魅力:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>威望:</b></td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userpower value=""></td> 
<td valign=middle align=right class=tablebody2 height="22">您的威望:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>文章数:</b><br>加入本<%=Mpmc%>必须达到的发贴数</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userarticle value=""></td> 
<td valign=middle align=right class=tablebody2 height="22">您的贴数:&nbsp;</td>                                                                                                                                                                                       
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<%=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text%></td>                                                                                                                                                                                        
  </tr>                                                                                                                                                                                        
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>用户等级:</b><br>加入本<%=Mpmc%>必须具备的等级(1～<%=maxtitleid%>)</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 height="22">&nbsp;<INPUT name=userclass value="1"></td> 
<td valign=middle align=right class=tablebody2 height="22">您的等级:&nbsp;</td>                                                                                                                                                                                     
<td valign=middle align=left class=tablebody1 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=tablebody1 height=22 colspan="4"><font color="#CC9933">
如果<%=Mpmc%>性质是<%=Sl1%>，则以上6项(金钱,魅力,经验,威望,文章数,用户等级)不必填写</font>
</td>
</tr> 
<tr><td height=8 class=tablebody2 colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody2 height="22"><b>本<%=Mpmc%>简介:</b><br>对您的<%=Mpmc%>作简单的介绍，在您的<%=Mpmc%>资料中会显示出来</td>                                                                                                                                                                                        
<td valign=middle align=left class=tablebody1 colspan="3" height="22">&nbsp;<textarea name=menpaireadme rows="4" cols="60"></textarea>(不要超过100个英文或50个汉字)</td>                                                                                                                                                                                      
  </tr>  
<tr><td height=8 class=tablebody2 colspan="4"></td></tr>                                                                                                                                                                                       
  <tr>                                                                                                                                                                                       
    <td valign=middle align=center class=tablebody1 colspan="4" height="22"><INPUT type=submit value=申请新<%=Mpmc%> name=submit></td>                                                                                                                                                                                       
  </tr>                                                                                                                                                                              
  </form>                                                                                                                                                                                    
</table>                                                                                                                                                                                           
<%                                             
end sub                                                                                                                                                                                                                            

'------------------------------------部落申请====提交申请--------------------------------
sub applynewmenpai() 
dim MenpaiAttri,userwealth,usercp,userep,userpower,userclass,userartitle
GroupName=dvbbs.checkStr(trim(Request.form("groupname")))
MenpaiAttri=Request.form("menpaiattri")

if GroupName="" then
Errmsg=Errmsg+"<br>"+"<li>请输入"&Mpmc&"名称"
Founderr=true
elseif strLength(GroupName)>12 then
Errmsg=Errmsg+"<br>"+"<li>"&Mpmc&"名称不能超过12个英文字母(6个汉字)"
Founderr=true
end if
if cint(MenpaiAttri)<>0 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/@userep").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/@usercp").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>您输入的威望有效值大于您自己的当前值！"
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"))>GetUserGroupID(Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userclass").text) 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>"&Mpmc&"简介不能超过100个英文或50个汉字"
Founderr=true
end if

if Founderr then exit sub

dim new_menpai_setting'new_menpai_setting(6)   创建部落收费
new_menpai_setting=split(conn.execute("select new_menpai_setting from [menpai]")(0),",")                         
                           
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>您输入的"&Mpmc&"名字已经存在"
Founderr=true
rs.close
set rs=nothing
exit sub
else                                  
rs.addnew                                                                                                                                                          
rs("Groupname")=GroupName
rs("Zangmen")=dvbbs.membername
rs("Addtime")=date()
rs("Menpai_setting")=MenpaiAttri & "|" & userwealth & "|" & userep & "|" & usercp & "|" & userpower & "|" & userartitle & "|" & userclass & "|" & menpaireadme
if cint(new_menpai_setting(7))=1 then
 rs("State")=3'等待审核
else
 rs("State")=0'不需要审核，直接开通
end if 
rs.update  
conn.execute("update [Dv_user] set usergroup='"&GroupName&"',userwealth=userwealth-"&new_menpai_setting(6)&" where username='"&dvbbs.membername&"'")                                            
end if
if cint(new_menpai_setting(7))=1 then
Sucmsg=Sucmsg+"<br>"+"<li>您成功创建了 " & GroupName & "，请等待管理员的审核"
else
Sucmsg=Sucmsg+"<br>"+"<li>新"&Mpmc&"已经成立，您成为该"&Mpmc&"的酋长了，恭喜新"&Zmmc&"上任"
end if
Sucmsg=Sucmsg+"<br>"+"<li>您被交了 "&new_menpai_setting(6)&" 元的创建部落费"
call menpai_suc()
end sub  
'--------------------------------发送短信息--------------------------------
sub sendmessage(Susername,menpainame)
dim message,title                                        
title=menpainame&" 清理门户通知"                                          
message=Susername&"你好！由于你不遵守"&Mpmc&"规条，已经被"&Zmmc&"清理出 "&menpainame
sql="insert into Dv_message (incept,sender,title,content,sendtime,flag,issend) values ('"&Susername&"','"&menpainame&"首脑','"&title&"','"&message&"',Now(),0,1)"                                          
conn.execute(sql)                                          
end sub                                                                                                                                                                                                                            
%>