<!--#include file=conn.asp-->
<!-- #include file="inc/const.asp" -->
<!--#include file=bank_data.asp-->
<!-- #include file="bank/bank_const.asp" -->
<!--#include file="bank/bank_accrual.asp"-->
<%
'=========================================================
' file: bank_fuwu.asp
' Version:2.1 for Dvbbs7.0
' date: 2004-1-7
' script modified by winriver from yaoyue Version
'=========================================================
' copyright (c) 2004 黄河论坛 all rights reserved.
' web: http://www.paperbridge.net http://www.winriver.org
' email: huanghetv@163.com winriver2002@yahoo.com
'=========================================================
Dvbbs.LoadTemplates("")
If Not IsObject(Conn) Then ConnectionDatabase
dim sql,rs,founderr,i,errmsg
founderr=false

dim cp,ep_fuwu,power,article,announce,message,delmail,ip,fuwu_setting
dim menu,boardid
if not Dvbbs.FoundUser then
    founderr=true
    errmsg=errmsg+errmsg6+"您还没有登录或注册，请先<a href=login.asp>登录</a>或<a href=reg.asp>注册</a>。"
    Dvbbs.Stats="钱庄错误信息"
    call Dvbbs.Nav()
	call new_head()
    Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
	call Dvbbs.ActiveOnline()
	call Dvbbs.Footer()
	response.end
end if
if not foundbankuserid then
    founderr=true
    errmsg=errmsg+errmsg6+"您还没有在钱庄开户。"
    Dvbbs.Stats="钱庄错误信息"
    call Dvbbs.Nav()
	call new_head()
    Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
end if
if not everybody then
    founderr=true
    errmsg=errmsg+errmsg6+"只有官方钱庄才开通特殊服务！"
    Dvbbs.Stats="钱庄错误信息"
    call Dvbbs.Nav()
	call new_head()
    Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
end if
if not foundbankid then
    founderr=true
    errmsg=errmsg+errmsg6+"没有找到该钱庄。<li>该钱庄还没有开放<li>非法操作"
    Dvbbs.Stats="钱庄错误信息"
    call Dvbbs.Nav()
	call new_head()
    Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
end if
if userfreeze then
    founderr=true
    errmsg=errmsg+errmsg6+"你在本钱庄的帐号已经被冻结，请联系掌柜。"
    Dvbbs.Stats="钱庄错误信息"
    call Dvbbs.Nav()
	call new_head()
    Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
end if

Dvbbs.Stats="特殊服务"
call Dvbbs.Nav()
	call new_head()
call getinfo()
menu=request.form("menu")
if menu="" then
	call main()       	'服务页面
elseif menu=1 then
	call jy()			'购买经验值
elseif menu=2 then
	call ml()			'购买魅力值
elseif menu=3 then
	call buy_power()	'购买威望值
elseif menu=4 then
	call ft()			'购买发贴数
elseif menu=5 then
	call fgg()			'发公告		
elseif menu=6 then
	call fdx()			'群发短信
elseif menu=7 then
	call kip()			'查会员ip
elseif menu=8 then
	call syj()			'删除邮件
end if
call Dvbbs.ActiveOnline()

if founderr then
Dvbbs.Stats="钱庄错误信息"
Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
end if
call Dvbbs.Footer()

sub getinfo()
sql="select * from bankconfig"
set rs=cjconn.execute(sql)
cp=rs("cp") 				'购买魅力的价格
ep_fuwu=rs("ep")			'购买经验的价格
power=rs("power")			'购买发贴数的价格
article=rs("article")		'购买威望的价格
announce=rs("announce")		'发公告的价格
message=rs("message")		'发短信息的价格
ip=rs("ip")					'查ip的价格
delmail=rs("delmail")		'删除1邮件的环保基金单价
fuwu_setting=split(rs("fuwu_setting"),",")        '是否开通服务设置
rs.close
end sub

sub main()
call Dvbbs.ActiveOnline()
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
  <tr>
    <th width="100%" height=25 colspan=2><%=bankname%>特殊服务</td>
  </tr>
  <tr>
    <td width="100%" colspan=2 class=tablebody2><center>
      <marquee scrollamount=2 width=80% onmouseover='this.stop()' onmouseout='this.start()'><%if isbankmaster then%><a href=bank_masterwork.asp?bankid=<%=bankid%>>欢迎总掌柜光临，若有需要，请点击进入帐房。</a><%else%>欢迎您光迎<font color=#ff0000><b><%=bankname%></b></font>，本钱庄将竭诚为您服务。本钱庄简介：<%=msg%><%end if%></marquee></center>
    </td>
  </tr>
  <tr>
    <td width="40%" class=tablebody2 rowspan=6 valign=top>
      <table border="0" width="100%" cellspacing="3">
        <tr>
          <td width="100%" align=center colspan=2>
<%call bankdetail()
          %>
          </td>
        </tr>
        <tr>
          <td width="100%" align=center colspan=2>
<br>
<%call fuwuinfo()
          %>
          </td>
        </tr>
        <tr>
          <td width="100%" align=center colspan=2>
<br>
<%call personalinfo()%>
          </td>
        </tr>
      </table>
    </td>
    <td width="60%" class=tablebody1 valign=top>

<%call fuwu_main()%>

          </td>
        </tr>
    </table>
    </td>
  </tr>
</table>
<%
end sub


sub personalinfo()
%>
 <table cellpadding=5 cellspacing=1 class=tableborder1 align="center" style=width:98%>
      <tr><th colspan="2">您的属性信息</th></tr>
        <tr> 
          <td align="center" class=tablebody2 width=50%>现金总数</td>
          <td align="center" class=tablebody1 width=50%><b><%= U_wealth %></b></td>
        </tr>
        <tr> 
          <td align="center" class=tablebody2>经验值</td>
          <td align="center" class=tablebody1><b><%= U_ep %></b></td>
        </tr>
        <tr> 
          <td align="center" class=tablebody2>魅力值</td>
          <td align="center" class=tablebody1><b><%= U_cp %></b></td>
        </tr>
        <tr> 
          <td align="center" class=tablebody2>威望值</td>
          <td align="center" class=tablebody1><b><%= U_power %></b></td>
        </tr>
        <tr> 
          <td align="center" class=tablebody2>发帖数</td>
          <td align="center" class=tablebody1><b><%= U_post %></b></td>
        </tr>
    </table>
<%
end sub



sub fuwuinfo()
%>
 <table cellpadding=5 cellspacing=1 class=tableborder1 align="center" style=width:98%>
  <tr> 
    <th colspan="3">特殊服务交易信息</th>
  </tr>
  <tr> 
    <td align="center" class=tablebody2 width=40%>项目</td>
    <td align="center" class=tablebody2 width=35%>单价</td>
    <td align="center" class=tablebody2 width=25%>是否开通</td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>购买经验值</td>
    <td align="center" class=tablebody1><b><%= ep_fuwu %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(1))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>购买魅力值</td>
    <td align="center" class=tablebody1><b><%= cp %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(0))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>购买威望值</td>
    <td align="center" class=tablebody1><b><%= power %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(2))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>购买发帖数</td>
    <td align="center" class=tablebody1><b><%= article %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(3))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>发布公告</td>
    <td align="center" class=tablebody1><b><%= announce %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(4))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>短消息群发</td>
    <td align="center" class=tablebody1><b><%= message %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(5))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>看ip</td>
    <td align="center" class=tablebody1><b><%= ip %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(6))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2>删除邮件(奖)</td>
    <td align="center" class=tablebody1><b><%= delmail %></b></td>
    <td align="center" class=tablebody1><%if cint(fuwu_setting(7))=1 then%><font color=blue>√</font><%else%><font color=red>×</font><%end if%></td>
  </tr>
</table>
<%
end sub


'-------------------------------删除邮件-----------------------------------
sub syj()
	if cint(fuwu_setting(7))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	founderr=false
	set rs=server.createobject("adodb.recordset")
	sql="select * from [dv_message] where flag=1 and issend=1 and incept='"&Dvbbs.MemberName&"' "
	rs.open sql,conn,1,3
	
	if not (rs.eof and rs.bof) then       '是否有已读的短信息
		rs.close
		dim cunm
		set rs=conn.execute("select count(incept) from [dv_message] where flag=1 and issend=1 and sender<>'"&Dvbbs.MemberName&"' and incept='"&Dvbbs.MemberName&"'")
		cunm=clng(rs(0))		'统计已读的又不是自己发给自己的短信息 2002.11.30
		rs.close
		
	  	conn.execute("delete from [dv_message] where flag=1 and issend=1 and incept='"&Dvbbs.MemberName&"'")
		
		'删除自己发给自己的信件不发环保奖金
		if cunm=0 then
			errmsg=errmsg+errmsg6+"你的收件箱只有自己发给自己的信件，所以您没有得到环保奖金"
			Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"			
			exit sub		
		end if
			
		sql="select * from [dv_user] where username='"&Dvbbs.MemberName&"' "
		rs.open sql,conn,1,3
		rs("userwealth") = rs("userwealth")+delmail*cunm
		rs.update
		rs.close   
	 '后句那一刀加 
		call  HyhSaveCookie(delmail*cunm,0,0,0,0,0) 
			sql = "select * from [bank] where bankid="&bankid
			rs.open sql,cjconn,1,3
			rs("stockpile")=rs("stockpile")-delmail*cunm
			rs.update
			rs.close
			
      if openeventslog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','清空已读收件得环保奖金',"&delmail*cunm&")")
      end if
%>    
<table border=0 cellspacing=1 cellpadding=3 align=center class=tableborder1><tr><th height=26 >清空已读收件得环保奖金</th></tr><tr><td align=center height=70 class=tablebody1><%response.write "<li>你的收件箱已经清空，得到环保奖金<font color=red>"&delmail&"元/封×"&cunm&"封="&delmail*cunm&"元</font>"%>
<br></td></tr><tr><td align=center height=26 class=tablebody2><a href="?bankid=<%=bankid%>">返回</a></td></tr></table>          
<%          
	else
		rs.close
		set rs=nothing
		errmsg=errmsg+errmsg6+"您的收件箱中没有已读短信息!"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"		
	end if
 
end sub

'------------------------------看ip--------------------------------
sub kip()
	if cint(fuwu_setting(6))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	
	dim rsip,sqlip
	set rs=server.createobject("adodb.recordset")
	set rsip=server.createobject("adodb.recordset")
	sql="select userwealth from [dv_user] where username='"&Dvbbs.MemberName&"' "
	rs.open sql,conn,1,3
	if request.form("user")="" then
		errmsg=errmsg+errmsg6+"你要看谁的ip呀？"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"		
	elseif rs(0)<ip then
		errmsg=errmsg+errmsg6+"你的现金不够!"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"		
	elseif trim(request.form("user"))="winriver" then
		errmsg=errmsg+errmsg6+"<font color=blue>winriver说：</font><font color=red>拜托，不要查我的ip，好吧，这次免费的喔，感谢您对我的关心!</font>"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"		
	else
		
		sqlip="select ip from [dv_online] where username='"&Dvbbs.CheckStr(trim(request.form("user")))&"' "
		rsip.open sqlip,conn,1,3
		if rsip.eof then
			errmsg=errmsg+errmsg6+"对不起此用户不在线"
			Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"			
		else
%>    
<table border=0 cellspacing=1 cellpadding=3 align=center class=tableborder1><tr><th height=26 >查看 <font color=red><%=Dvbbs.HTMLEncode(request.form("user"))%></font> 的ip信息</th></tr><tr><td align=center height=70 class=tablebody1>会员：<font color=navy><%=Dvbbs.HTMLEncode(request.form("user"))%></font> 的ip是：<font color=red><%=rsip(0)%></font><br><br>来自：<font color=red><%=Dvbbs.address(rsip(0))%></font><br></td></tr><tr><td align=center height=26 class=tablebody2><a href="?bankid=<%=bankid%>">返回</a></td></tr></table>          
<%          
			rsip.close          
			rs("userwealth")=rs("userwealth")-ip
			rs.update          
			rs.close
			'后句那一刀加 
		  call  HyhSaveCookie(-ip,0,0,0,0,0)          
			sql = "select * from [bank] where bankid="&bankid
			rs.open sql,cjconn,1,3
			rs("stockpile")=rs("stockpile")+ip
			rs.update
			rs.close
			
      if openeventslog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','查看ip',"&ip&")")
      end if
		end if          
	end if          
          
end sub         
            
'-------------------------------群发短信-----------------------------------
sub fdx()   
	if cint(fuwu_setting(5))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	       
	dim content,rsdx,sqldx
	set rs=server.createobject("adodb.recordset")          
	set rsdx=server.createobject("adodb.recordset")          
	sql="select userwealth from [dv_user] where username='"&Dvbbs.MemberName&"' "          
	rs.open sql,conn,1,3          
	if request.form("title")="" then          
		errmsg=errmsg+errmsg6+"标题不能为空,请输入标题"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"            
	elseif request.form("content")="" then          
		errmsg=errmsg+errmsg6+"你的内容是空的,必须填写内容"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"              
	elseif rs("userwealth")<message then          
		errmsg=errmsg+errmsg6+"你的现金不够!"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"     
	else          
		rs("userwealth")=rs("userwealth")-message
		rs.update          
		rs.close 
		'后句那一刀加 
		call  HyhSaveCookie(-message,0,0,0,0,0)         
        if request.form("stype") = "-2" then 
			content="短消息群发：所有在线会员"
			sql="select username from [dv_online]"
			call sendmsg()
         elseif request.form("stype") = "-1" then
		 	content="短消息群发：所有管理员、版主和贵宾"
			sql="select username,usergroupid from [dv_user] where usergroupid=1 or usergroupid=2 or usergroupid=3 or usergroupid=8"
			call sendmsg()
         else
			sql="select u.username,u.usergroupid,g.title from [dv_user] u inner join [dv_usergroups] g on u.usergroupid=g.usergroupid where u.usergroupid="&cint(request.form("stype"))
			rs.open sql,conn,1,3
			if not rs.eof then
		 	content="短消息群发：所有"&rs("title")
		 	else
		 	content=""
		 	end if
			do while not rs.eof
				sqldx="select * from [dv_message]"
				rsdx.open sqldx,conn,1,3
				rsdx.addnew
				rsdx("sender")=Dvbbs.MemberName
				rsdx("incept")=rs("username")
				rsdx("title")=request.form("title")
				rsdx("content")=request.form("content")
				rsdx("issend")=1
				rsdx.update
				rsdx.close
				call update_user_msg(rs("username"))
				rs.movenext
			loop
		end if
		rs.close
			sql = "select * from [bank] where bankid="&bankid
			rs.open sql,cjconn,1,3
			rs("stockpile")=rs("stockpile")+message
			rs.update
			rs.close
			
      if openeventslog=-1 and content<>"" then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','"&content&"',"&message&")")
      end if
			call yaoyue_banksuc()
	end if          
end sub           
       
'---------------------------------发公告-------------------------------
sub fgg()    
	if cint(fuwu_setting(4))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	      
	if trim(request.form("title"))="" then
		founderr=true 
		errmsg=errmsg+errmsg6+"公告标题不能为空,请输入标题" 
	end if
	if trim(request.form("content"))="" then
		founderr=true 
		errmsg=errmsg+errmsg6+"公告内容是空的,必须填写内容" 
	end if
	if U_wealth<announce then
		founderr=true 
		errmsg=errmsg+errmsg6+"你的现金不够" 
	end if
	boardid=int(request.form("boardid"))		
         
	if founderr then
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"        
	else          
		conn.execute("update [dv_user] set userwealth=userwealth-"&announce&" where userid="&Dvbbs.userid)
		'后两句那一刀加
      Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text=Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text-announce
		set rs=server.createobject("adodb.recordset")		         
		sql="select * from [dv_bbsnews]"          
		rs.open sql,conn,1,3          
		rs.addnew          
		rs("boardid")=boardid        
		rs("username")=request.form("username")          
		rs("title")=request.form("title")          
		rs("content")=request.form("content")          
		rs.update          
		rs.close 
		'那一刀改
		'Dvbbs.DelCahe "news"&boardid
		         
			sql = "select * from [bank] where bankid="&bankid
			rs.open sql,cjconn,1,3
			rs("stockpile")=rs("stockpile")+announce
			rs.update
			rs.close
			
      if openeventslog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','发公告',"&announce&")")
      end if
			call yaoyue_banksuc()
	end if          
end sub           
          
'--------------------------------购买威望值------------------------- 
sub buy_power() 
	if cint(fuwu_setting(2))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	         
	dim jinyan
	jinyan=0
	set rs=server.createobject("adodb.recordset")          
	sql="select userwealth,userpower from [dv_user] where username='"&Dvbbs.MemberName&"' "          
	rs.open sql,conn,1,3
       
		if request.form("power")="" then
			founderr=true 
			errmsg=errmsg+errmsg6+"请输入您要购买的威望值"
		elseif not isnumeric(request.form("power")) then
			founderr=true 
			errmsg=errmsg+errmsg6+"购买的威望值必须是数字"
		elseif request.form("power")<0 then
			founderr=true
			errmsg=errmsg+errmsg6+"请不要输入负数"		
		else
			jinyan=abs(int(request.form("power")))
		end if
      	if rs(0)<jinyan*power then         
			founderr=true 
			errmsg=errmsg+errmsg6+"您的现金不够"
		end if			
		if founderr then
			Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
        else          
			rs(0)=rs(0)-jinyan*power
			rs(1)=rs(1)+jinyan          
			rs.update          
			rs.close
			'后句那一刀加 
		  call  HyhSaveCookie(-jinyan*power,0,0,jinyan,0,0)          
			sql = "select * from [bank] where bankid="&bankid          
			rs.open sql,cjconn,1,3                      
			rs("stockpile")=rs("stockpile")+jinyan*power
			rs.update          
			rs.close
			
      if openeventslog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','购买威望值',"&jinyan*power&")")
      end if
			call yaoyue_banksuc()
      end if           
end sub           
          
'--------------------------------购买发贴数-------------------------          
sub ft() 
	if cint(fuwu_setting(3))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	         
	dim jinyan
	jinyan=0
	set rs=server.createobject("adodb.recordset")          
	sql="select userwealth,UserPost from [dv_user] where username='"&Dvbbs.MemberName&"' "          
	rs.open sql,conn,1,3
       
		if request.form("article")="" then
			founderr=true 
			errmsg=errmsg+errmsg6+"请输入您要购买的发帖数"
		elseif not isnumeric(request.form("article")) then
			founderr=true 
			errmsg=errmsg+errmsg6+"购买的发帖数必须是数字"
		elseif request.form("article")<0 then
			founderr=true
			errmsg=errmsg+errmsg6+"请不要输入负数"		
		else
			jinyan=abs(int(request.form("article")))
		end if
      	if rs(0)<jinyan*article then         
			founderr=true 
			errmsg=errmsg+errmsg6+"您的现金不够"
		end if			
		if founderr then
			Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
        else          
			rs(0)=rs(0)-jinyan*article
			rs(1)=rs(1)+jinyan          
			rs.update          
			rs.close 
			'后句那一刀加 
		  call  HyhSaveCookie(-jinyan*article,0,0,0,0,jinyan)          
			sql = "select * from [bank] where bankid="&bankid          
			rs.open sql,cjconn,1,3                      
			rs("stockpile")=rs("stockpile")+jinyan*article
			rs.update          
			rs.close
			
      if openeventslog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','购买发帖数',"&jinyan*article&")")
      end if
			call yaoyue_banksuc()
      end if           
end sub 
          
'--------------------------------购买魅力值-------------------------          
sub ml()  
	if cint(fuwu_setting(0))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	         
	dim jinyan
	jinyan=0
	set rs=server.createobject("adodb.recordset")          
	sql="select userwealth,usercp from [dv_user] where username='"&Dvbbs.MemberName&"' "          
	rs.open sql,conn,1,3
       
		if request.form("cp")="" then
			founderr=true 
			errmsg=errmsg+errmsg6+"请输入您要购买的魅力值"
		elseif not isnumeric(request.form("cp")) then
			founderr=true 
			errmsg=errmsg+errmsg6+"购买的魅力值必须是数字"
		elseif request.form("cp")<0 then
			founderr=true
			errmsg=errmsg+errmsg6+"请不要输入负数"		
		else
			jinyan=abs(int(request.form("cp")))
		end if
      	if rs(0)<jinyan*cp then         
			founderr=true 
			errmsg=errmsg+errmsg6+"您的现金不够"
		end if			
		if founderr then
			Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
        else          
			rs(0)=rs(0)-jinyan*cp
			rs(1)=rs(1)+jinyan          
			rs.update          
			rs.close 
			'后句那一刀加 
			call  HyhSaveCookie(-jinyan*cp,jinyan,0,0,0,0)         
			sql = "select * from [bank] where bankid="&bankid          
			rs.open sql,cjconn,1,3                      
			rs("stockpile")=rs("stockpile")+jinyan*cp
			rs.update          
			rs.close
			
      if openeventslog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','购买魅力值',"&jinyan*cp&")")
      end if
			call yaoyue_banksuc()
      end if           
end sub 
          
'--------------------------------购买经验值-------------------------          
sub jy() 
	if cint(fuwu_setting(1))=0 then 
		founderr=true
		errmsg=errmsg+errmsg6+"该服务已经暂停，请与管理员联系"
		Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
		exit sub
	end if
	         
	dim jinyan     
	jinyan=0     
	set rs=server.createobject("adodb.recordset")          
	sql="select userwealth,userep from [dv_user] where username='"&Dvbbs.MemberName&"' "          
	rs.open sql,conn,1,3
       
		if request.form("ep")="" then
			founderr=true 
			errmsg=errmsg+errmsg6+"请输入您要购买的经验值"
		elseif not isnumeric(request.form("ep")) then
			founderr=true 
			errmsg=errmsg+errmsg6+"购买的经验值必须是数字"
		elseif request.form("ep")<0 then
			founderr=true
			errmsg=errmsg+errmsg6+"请不要输入负数"		
		else
			jinyan=abs(int(request.form("ep")))
		end if
      	if rs(0)<jinyan*ep_fuwu then         
			founderr=true 
			errmsg=errmsg+errmsg6+"您的现金不够"
		end if			
		if founderr then
			Response.redirect "showerr.asp?ErrCodes="&errmsg&"&action=OtherErr"
        else          
			rs(0)=rs(0)-jinyan*ep_fuwu          
			rs(1)=rs(1)+jinyan
  		rs.update          
			rs.close
			'后句那一刀加 
			call  HyhSaveCookie(-jinyan*ep_fuwu,0,jinyan,0,0,0)          
			sql = "select * from [bank] where bankid="&bankid          
			rs.open sql,cjconn,1,3                      
			rs("stockpile")=rs("stockpile")+jinyan*ep_fuwu          
			rs.update          
			rs.close
			
      if openeventslog=-1 then
          cjconn.execute ("insert into bankevent (bankid,name1,name2,events,trade) values ("&cint(request("bankid"))&",'"&Dvbbs.MemberName&"','','购买经验值',"&jinyan*ep_fuwu&")")
      end if
			call yaoyue_banksuc()
      end if           
end sub 
        
sub fuwu_main()    
%>
<br>
<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style=width:98%>
<tr>          
<th>属性值交易</th>          
</tr>
          
<form name="form1" method="post" action="?bankid=<%=bankid%>"><tr><td align=left height=30 class=tablebody1><b>购买经验值</b> (请输入您要购买多少经验值):<input name=ep> <input type=submit value=购买 name=submit></td></tr><input type=hidden value="1" name=menu></form>

<form name="form2" method="post" action="?bankid=<%=bankid%>"><tr ><td align=left height=30 class=tablebody1><b>购买魅力值</b> (请输入您要购买多少魅力值):<input name=cp> <input type=submit value=购买 name=submit class=tablebody1></td></tr><input type=hidden value="2" name=menu></form>

<form name="form3" method="post" action="?bankid=<%=bankid%>"><tr ><td align=left height=30 class=tablebody1><b>购买威望值</b> (请输入您要购买多少威望值):<input name=power> <input type=submit value=购买 name=submit></td></tr><input type=hidden value="3" name=menu></form>

<form name="form4" method="post" action="?bankid=<%=bankid%>"><tr ><td align=left height=30 class=tablebody1><b>购买发贴数</b> (请输入您要购买多少发贴数):<input name=article> <input type=submit value=购买 name=submit></td></tr><input type=hidden value="4" name=menu></form>
</table>

<form name="form5" method="post" action="?bankid=<%=bankid%>">
<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style=width:98%>
<tr>          
<th colspan="2">公告发布</th>          
</tr>
<tr>
<td align=center class=tablebody2 width=35%>发布版面</td>
<td align=left class=tablebody1 width=55%>
<% set rs=server.createobject("adodb.recordset")         
sql="select boardid,boardtype from dv_board"          
   rs.open sql,conn,1,1          
%>          
        <select name="boardid" size="1">          
          <option value="0">论坛首页</option>
          <%
	do while not rs.eof
        response.write "<option value='"+cstr(rs("boardid"))+"'>"+rs("boardtype")+"</option>"+chr(13)+chr(10)
	rs.movenext
	loop
	rs.close
%>
        </select>          
</td></tr>          
<tr>           
      <td align=center valign=middle class=tablebody2>发 布 人</td>          
      <td class=tablebody1>          
        <input type=text name=username size=36 value="<%=Dvbbs.MemberName%>" disabled>          
        <input type=hidden name=username value="<%=Dvbbs.MemberName%>">          
      </td>          
    </tr>          
    <tr>           
      <td align=center valign=middle class=tablebody2>标　　题</td>          
      <td class=tablebody1>          
        <input type=text name=title size=36>          
      </td>          
    </tr>          
    <tr>           
      <td align=center valign=middle class=tablebody2>内　　容</td>          
      <td class=tablebody1>          
        <textarea cols=65 rows=6 name="content"></textarea>          
      </td>          
    </tr>          
    <tr>          
      <td width="100%" valign=middle colspan="2" align=center class=tablebody2><input type=submit value="发 送" name=submit>&nbsp;<input type="reset" name="clear" value="清 除"></td>          
    </tr>          
</table>          
          
<input type=hidden value="5" name=menu>
</form>          
          
          
<form name="form6" method="post" action="?bankid=<%=bankid%>">
<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style=width:98%>
<tr>          
<th colspan="2">短消息群发</th>          
</tr>
<tr>           
                  <td width="30%" class=tablebody2>消息标题</td>          
                  <td width="70%" class=tablebody1>           
                    <input type="text" name="title" size="50">          
                  </td>          
                </tr>          
<tr>           
                  <td width="30%" class=tablebody2>接收方选择</td>          
                  <td width="70%" class=tablebody1>           

<%call getgroup()%>

                  </td>
                </tr>
                <tr> 
                  <td width="30%" height="20" valign="middle" class=tablebody2>
                    <p>消息内容</p>
                  </td>
                  <td width="70%" height="20" class=tablebody1> 
                    <textarea name="content" cols="65" rows="10"></textarea>
                  </td>
                </tr>
                <tr> 
                  <td colspan=2 align=center height="23" class=tablebody2><input type="submit" name="submit" value="发送消息">  <input type="reset" name="submit2" value="重新填写">
                  </td>
                </tr>
</table>
<input type=hidden value="6" name=menu>
</form>

<table cellspacing=1 cellpadding=3 align=center class=tableborder1 style=width:98%>
<tr>          
<th colspan="2">其它服务</th>          
</tr>
<form name="form7" method="post" action="?bankid=<%=bankid%>">
<tr><td height=30 class=tablebody1>
<b>查看在线会员ip</b>　查看 <input name=user> 的ip和来源 <input type=submit value=查看 name=submit>
<input type=hidden value="7" name=menu>
</td></tr>
</form>          

<form name="form8" method="post" action="?bankid=<%=bankid%>">          
<tr><td height=30 class=tablebody1>
<b>删除已读短消息</b>　(每次删除将得到钱庄 <font color=red><%=delmail%>元×短信息条数 </font> 环保奖金)  <input type=submit value=删除 name="b1" onclick="javascript:{if(confirm('您确定执行删除操作吗?')){return true;}return false;}">
</td></tr>
</table>
<input type=hidden value="8" name=menu>
</form>          
<br>          
<%          
end sub          


sub bankdetail()
%>
 <table cellpadding=5 cellspacing=1 class=tableborder1 align="center" style=width:98%>
  <tr> 
    <th align="center"><%=bankname%>信息</td>
    <th align="center">掌柜信息</td>
  </tr>
  <tr> 
    <td align="center" class=tablebody2 width=60%>
<table border="0" width="95%" cellspacing="3" align=center>
        <tr>
          <td width="100%">
          <%
            response.write "钱庄掌柜：<font color=#990000><a href=dispuser.asp?name="&bankmaster&" target=_blank title=点击查看该掌柜的详细资料><b>"&bankmaster&"</b></a></font><br>"
            response.write "存款总额：<font color=#ff0000>"&alldeposit&"</font><br>现有库金：<font color=#ff0000>"&stockpile&"</font><br>库存魅力：<font color=#ff0000>"&loveliness&"</font><br>客户数量：<font color=#ff0000>"&clientcount&"</font><br>被贷款数：<font color=#ff0000>"&bpaymentforgoods&"</font><br>钱庄性质：<font color=red>"
            if everybody then
                response.write "官方钱庄"
            else
                response.write "私人钱庄"
            end if
            response.write "</font>"
          %>
      </td></tr></table>
	</td>
    <td align="center" class=tablebody2 width=40% valign=top>
<table border="0" width="90%" cellspacing="3" align=center>
        <tr>
          <td width="100%">
          <%
          response.write "现金：<font color=#ff0000>"&buserwealth&"</font><br>积分：<font color=#ff0000>"&buserep&"</font><br>魅力：<font color=#ff0000>"&busercp&"</font>"
          %>
      </td></tr></table>
	</td>
  </tr>
</table>
<%
end sub


sub getgroup()
dim rs,sql
%>
<select name="stype">
    <option value="-2" selected>所有在线用户</option>
    <option value="-1">所有管理员、版主和贵宾</option>
<%
set rs=server.createobject("adodb.recordset")
sql="select usergroupid,title from dv_usergroups"
rs.open sql,conn,1,3
do while not rs.eof
if (rs("usergroupid")<4 or rs("usergroupid")>7) and rs("title")<>"注册用户" then
%>
    <option value="<%=rs("usergroupid")%>">所有<%=rs("title")%></option>
<%
end if
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>
<%
end sub

sub sendmsg()
dim rsdx,sqldx
rs.open sql,conn,1,3
set rsdx=server.createobject("adodb.recordset")          
do while not rs.eof
	sqldx="select * from [dv_message]"
	rsdx.open sqldx,conn,1,3
	rsdx.addnew
	rsdx("sender")=Dvbbs.MemberName
	rsdx("incept")=rs("username")          
	rsdx("title")=request.form("title")          
	rsdx("content")=request.form("content")          
	rsdx("issend")=1          
	rsdx.update          
	rsdx.close          
	call update_user_msg(rs("username"))
	rs.movenext          
loop          
end sub



'更新用户短信通知信息（新短信条数||新短讯ID||发信人名）
Sub UPDATE_User_Msg(username)
	Dim msginfo,i,UP_UserInfo,newmsg
	newmsg=newincept(username)
	If newmsg>0 Then
		msginfo=newincept(username) & "||" & inceptid(1,username) & "||" & inceptid(2,username)
	Else
		msginfo="0||0||null"
	End If
	Dvbbs.execute("UPDATE [Dv_User] Set UserMsg='"&Dvbbs.CheckStr(msginfo)&"' WHERE username='"&Dvbbs.CheckStr(username)&"'")
	If username=Dvbbs.MemberName Then
			Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@usermsg").text=msginfo		
	Else
		Call Dvbbs.NeedUpdateList(username,1)
	End If
End Sub

'统计留言
Function newincept(iusername)
Dim Rss
Rss=Dvbbs.execute("SELECT Count(id) FROM Dv_Message WHERE flag=0 And issend=1 And DelR=0 And incept='"& iusername &"'")
    newincept=Rss(0)
	Set Rss=nothing
	If isnull(newincept) Then newincept=0
End Function

Function inceptid(stype,iusername)
	dim Rss
	Set Rss=Dvbbs.execute("SELECT top 1 id,sender FROM Dv_Message WHERE flag=0 And issend=1 And DelR=0 And incept='"& iusername &"'")
	If not Rss.eof Then
		If stype=1 Then
			inceptid=Rss(0)
		Else
			inceptid=Rss(1)
		End If
	Else
		If stype=1 Then
			inceptid=0
		Else
			inceptid="null"
		End If
	End If
	Set Rss=nothing
End Function
sub HyhSaveCookie(UserWealth,UserCP,UserEP,UserPower,UserMoney,Usertopic)
	DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@activetime").text = Now()
	DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@usermoney").text=DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@usermoney").text+cCur(UserMoney)
	DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text=DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userpost").text+Clng(Usertopic)
	DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text=DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userwealth").text+cCur(UserWealth)
	DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userep").text=DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userep").text+Clng(UserEP)
	DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text=DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@usercp").text+Clng(UserCP)
	DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text=DVBBS.UserSession.documentElement.selectSingleNode("userinfo/@userpower").text+Clng(UserPower)
end sub
%>

<%
'黄河7.0插件自助升级器2004-1-7 18:03:32自动添加
sub new_head()
Dvbbs.Head_var 3,0,"钱庄</a> → "&"<a href=bank_main.asp?bankid="&BankID&">"&bankname,"bank_index.asp"
end sub
%>