<!--#include file="z_bank_ChiefMSG.asp"-->
<%
dim BankUserID,bankID,Name,CurrDeposit,C_Accrual,TimeDeposit,T_Accrual,PaymentForGoods,P_Accrual,ByDetainCP,Realty,Events,C_date,T_date,P_date,ii
dim BankName,BankMaster,AllDeposit,LoveLiness,StockPile,Log_on,MSG,ClientCount,ZHML,EP,BPaymentForGoods,Integral,PFGTimes,EveryBody,uIntegral
dim BFace,BWidth,BHeight,BUserWealth,BUserEP,BUserCP
dim FoundBankID,FoundBankUserID,FoundBankUser,UserFreeze,IsBankID,OpenEventsLog,IsBankMaster,bankid_temp,founderr,usermoney,myuserCP,errmsg
dim crs,csql,Isboard
FoundBankID=false
FoundBankUserID=false
FoundBankUser=false
UserFreeze=false
IsbankID=false
OpenEventsLog=false
IsBankMaster=false
CurrDeposit=0
C_Accrual=0
TimeDeposit=0
T_Accrual=0
PaymentForGoods=0
P_Accrual=0
ByDetainCP=0
Realty=0
Isboard=0
ii=0

if not isnumeric(request("bankid")) or request("bankid")=0 or request("bankid")="" then
    IsbankID=false
    csql="select bankid,CurrDeposit,C_Accrual,TimeDeposit,T_Accrual,PaymentForGoods,P_Accrual,ByDetainCP,Realty from bankuser where name='"&login_username&"'"
else
    IsbankID=true
    csql="select bankuserid,name,CurrDeposit,C_accrual,TimeDeposit,T_accrual,PaymentForGoods,P_accrual,ByDetainCP,realty,events,DateAndTime,freeze from bankuser where bankid="&cint(request("bankid"))&" and name='"&login_username&"'"
end if
set crs=cjconn.execute (csql)
if crs.bof and crs.eof then
    FoundBankUserID=false
    FoundBankUser=false
    bankID=0
else
    if IsbankID then
        FoundBankUserID=true
        BankUserID=crs(0)
        Name=crs(1)
        CurrDeposit=crs(2)
        C_Accrual=crs(3)
        TimeDeposit=crs(4)
        T_Accrual=crs(5)
        PaymentForGoods=crs(6)
        P_Accrual=crs(7)
        ByDetainCP=crs(8)
        Realty=crs(9)
        Events=split(crs(10),"|")
        C_Date=crs(11)
        UserFreeze=crs(12)
    else
        FoundBankUser=true
        bankID=0
        do while not crs.eof
            bankid_temp=bankid_temp&crs(0)&" "
            CurrDeposit=Currdeposit+crs(1)
            C_Accrual=C_accrual+crs(2)
            TimeDeposit=TimeDeposit+crs(3)
            T_Accrual=T_Accrual+crs(4)
            PaymentForGoods=PaymentForGoods+crs(5)
            P_Accrual=P_Accrual+crs(6)
            ByDetainCP=ByDetainCP+crs(7)
            Realty=Realty+crs(8)
            crs.movenext
        loop
        bankid_temp=replace(trim(bankid_temp)," ",",")
    end if
end if
if IsbankID then
    bankID=cint(request("bankid"))
    csql="select bankname,bankmaster,alldeposit,loveliness,stockpile,log_on,msg,ClientCount,ZHML,EP,PaymentForGoods,integral,PFGTimes,Everybody,EventsLog from bank where bankid="&bankID&" and opened=yes"
    set crs=cjconn.execute (csql)
    if crs.bof and crs.eof then
        FoundBankID=false
    else
        FoundBankID=true
        Isboard=3
        BankName=crs(0)
        BankMaster=crs(1)
        AllDeposit=crs(2)
        LoveLiness=crs(3)
        StockPile=crs(4)
        Log_on=crs(5)
        MSG=crs(6)
        ClientCount=crs(7)
        ZHML=crs(8)
        EP=crs(9)
        BPaymentForGoods=crs(10)
        integral=crs(11)
        PFGTimes=crs(12)
        EveryBody=crs(13)
        OpenEventsLog=crs(14)
        if BankMaster=login_username then
            IsBankMaster=true
        else
            IsbankMaster=false
        end if
        sql="select face,emoney,integral,usercp from user_data where hidden=1 and UserName='"&BankMaster&"'"
        set rs=conn.execute(sql)
        if rs.bof and rs.eof then
            response.write "<meta http-equiv=refresh content=""3;URL=index.asp""><b>该银行有问题，请联系管理员……</b>"
	        response.end
	    else
	        BFace=rs(0)
	        BUserwealth=rs(1)
	        BUserep=rs(2)
	        BUsercp=rs(3)
	    end if
	    set rs=nothing
	end if
end if
set crs=nothing

sub yaoyue_banksuc()
response.write "<br><table cellpadding=3 cellspacing=1 align=center class=tableborder1><tr align=center><th width='100%'><b>操作成功：</b></td></tr><tr><td width='100%' class=tablebody1>"
if request("action")="open"  then
    response.write "<meta http-equiv=refresh content=""3;URL=z_bank_main.asp?bankid="&request("bankid")&""">您在<font color=ff0000><b>"&bankname&"</b></font>开户成功，请选择您要返回的页面，三秒后将返回您开户的银行。"
elseif request("action")="off" then
    response.write "您在<font color=ff0000><b>"&bankname&"</b></font>消户成功。<meta http-equiv=refresh content=""3;URL=z_bank_index.asp"">"
elseif IsBankMaster and request("masterwork")<>"" then
    Response.Write "<meta http-equiv=refresh content=""3;URL=z_bank_MasterWork.asp?bankid="&bankid&"""><b>银行行长操作成功：</b>请选择您要返回的页面，三秒后将返回您的行长办公室。"
elseif not FoundBankID then
    response.write "<meta http-equiv=refresh content=""3;URL=z_bank_index.asp""><b>银行操作成功：</b>请选择您要返回的页面，三秒后将返回银行中心。"
else
    response.write "<meta http-equiv=refresh content=""3;URL=z_bank_main.asp?bankid="&bankid&"""><b>银行操作成功：</b>请选择您要返回的页面，三秒后将返回您操作的银行。"
end if
response.write "<br><br>"
if IsBankMaster and request("masterwork")<>"" then
    Response.Write "<li><a href=z_bank_MasterWork.asp?bankid="&BankID&">返回站长办公室</a></li>"
end if
response.write "<li><a href=z_bank_index.asp>返回银行中心</a></li>"
if FoundBankID then
    Response.Write "<li><a href=z_bank_main.asp?bankid="&request("bankid")&">返回银行</a></li>"
end if
Response.Write "<li><a href=index.asp>返回论坛首页</a></li></td></tr></table>"
end sub

Sub record(bonus)
dim txt1,fso,fil
Set Fso=Server.CreateObject("Scripting.FileSystemObject")
Set fil=Fso.OpenTextFile(Server.MapPath("data/bank_b.txt"))
txt1=fil.ReadLine
fil.Close
bonus=bonus+txt1
Set fil=Fso.CreateTextFile(Server.MapPath("data/bank_b.txt"),TRUE)
fil.write bonus
fil.Close
end sub
  sql="select * from user_data where username='"&login_username&"'"
  set rs=conn.execute(sql)
  if rs.bof and rs.eof then
   'founderr=true
   'Errmsg=Errmsg+"<br>"+"<li>您请注册后登陆</li>"
  else
    usermoney=rs("emoney")
    uintegral=rs("integral")
    myuserCP=rs("userCP")
    rs.close
  end if
sub bank_error()
%>
<%=errmsg %>请<a href=javascript:history.go(-1);>返回</a>。
<%
end sub

%>