<!-- #include file=../inc/BBSsetup.asp -->
<!-- #include file=../inc/User_Setup.ASP -->
<!-- #include file=../inc/Board_Popfun.asp -->
<%
Response.Expires = 0
Response.ExpiresAbsolute = DEF_Now - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private" 
Response.CacheControl = "no-cache"

DEF_BBS_HomeUrl = "../"

Dim SEP_PName,SEP_PVer,SEP_PDate
Dim SEP_HPath,SEP_LPath,SEP_FPath
Dim SEP_SetupInfo,SEP_IconInfo,SEP_MainInfo
Dim SEP_NoFSOInfo,SEP_AfterSetupInfo
Dim SEP_Copyright,SEP_CopyInfo
Dim SEP_Flag
Dim SEP_NP,SEP_GP,SEP_BtnD
Dim SEP_IMSG
Dim SEP_INS_Item,SEP_INS_ItemNum,SEP_INS_ItemInfo

SEP_PName = "LeadBBS Bank"
SEP_PVer = "0.5"
SEP_PDate = "2005-06-29"
SEP_HPath = ""
SEP_LPath = "http://www.leadbbs.com"
SEP_FPath = Array("","/a/a.asp?B=10&ID=859978")
SEP_SetupInfo = Array("欢迎您来到 " & SEP_PName & " v" & SEP_PVer & " 安装程序","此步骤将检测服务器及已经安装的银行程序","请选择需要安装的文件","文件更新完成","安装程序已经完成")
SEP_IconInfo = Array("检测系统","选择安装","更新文件")
SEP_MainInfo = Array("欢迎您来到 " & SEP_PName & " v" & SEP_PVer & " 安装程序，此程序将引导您安装、卸载以及升级银行系统。","您可以在此步骤检测您服务器的相关设置，以确定是否需要进行手动安装。","您可以在此步骤选择您所需的的组建进行安装/卸载。","请您察看安装的组件状态。","安装已经完成，感谢您选用 " & SEP_PName & " ，请您点击“完成”进入论坛。")
SEP_CopyRight = "oNet"
SEP_CopyInfo = "最终用户许可协议" & VbCrLf & VbCrLf & "插件作者享有最终解释权" & VbCrLf & VbCrLf & "本插件版权由插件作者享有，用户享有使用及修改的权利。如果要对插件进行转载或其他操作，请联系插件作者，并保留其版权信息。禁止任何人在违反此协议的前提下，使用此插件。" & VbCrLf & VbCrLf & "为了打击盗版软件，请确定您的所下载的插件来自以下的站点：" & VbCrLf & VbCrLf & SEP_HPath & SEP_FPath(0) & VbCrLf & SEP_LPath & SEP_FPath(1)

SEP_NoFSOInfo = "您的空间并不支持 FSO 组件，请您手动完成文件更新操作：<br>具体操作请参阅 http://ashi.cn/spct/go.asp?id=0"
SEP_AfterSetupInfo = "安装程序已经完成，您可以进入管理界面进行设置：<br>具体操作请参阅 http://ashi.cn/spct/go.asp?id=0"

SEP_INS_Item = Array("银行主程序","升级数据库","升级gafc版银行 <input type=text name=gdbpath value=Plug-ins/bank/data/#bank.mdb maxlength=255 size=14 class=TxtInpt>")
SEP_INS_ItemNum = Ubound(SEP_INS_Item,1)
SEP_INS_ItemInfo = Array("包含银行的基本组件，必须安装。包括后台管理程序、银行前台。","升级论坛数据库，以使用银行程序。在论坛数据库中创建银行所用字段。","升级 gafc 的银行系统。请在下框输入数据库地址，注意：此地址相对于论坛目录，即 http://www.aaa.com/Leadbbs/，不用加入/，输入错误可造成安装失败！请确认地址正确。")

GetPID
%>
<html>

<head>
<title>LeadBBS - <%=SEP_PName & " " & SEP_PVer & " " & " - " & SEP_PDate%></title>
<style>
Body{Font-Size:9pt;Font-Family:"宋体";Color:#0F52A4;filter:progid:DXImageTransform.microsoft.gradient(startColorStr=#ff4F87D7,endColorStr=#ff4678BF)}
Td{FONT-SIZE:9pt;}
A{Color:#0F52A4;TEXT-DECORATION:none}
A:hover{Color:#1368D0;TEXT-DECORATION:none}
.mainbo{Background:#155595}
.mainbg{Background:#CFE1F6}
.maintbg{Background:#D9E6F6}
.maintml{Background:#B7C7DA}
.Txtara{Font-Size:9pt;Background:#E6EDF6;Border:#848F9D 1px solid;Color:#0F52A4}
.TxtInpt{Font-Size:9pt;Border:#848F9D 1px solid;Color:#0F52A4;Height:18px}
.TxtTitle{Font-Size:14pt;Font-Family:"Arial"}
.TxtStep{Font-Size:40pt;Font-Family:"Arial";Color:#0A63CB}
.TxtCopy{Font-Size:8pt;Font-Family:"Arial";Color:#155595}
.TxtInfo{Color:#848F9D}
.mTitle{Color:#0A63CB}
.StepUn{filter:alpha(opacity=50)}
.tttbl{filter:progid:DXImageTransform.microsoft.gradient(gradientType=1,startColorStr=#ff4B77C0,endColorStr=#ff9CBFF7)}
.tttbm{filter:progid:DXImageTransform.microsoft.gradient(gradientType=1,startColorStr=#ff9CBFF7,endColorStr=#ff4B77C0)}
.tttbr{background:#4B77C0}
.ttmbl{filter:progid:DXImageTransform.microsoft.gradient(gradientType=1,startColorStr=#ff4678BF,endColorStr=#ff7BABDC)}
.ttmbm{filter:progid:DXImageTransform.microsoft.gradient(gradientType=1,startColorStr=#ff7BABDC,endColorStr=#ff4678BF)}
.ttmbr{background:#4678BF}
.inpbtn{width:60px;height:26px;Font-Size:9pt;Color:#0F52A4;border:0 none;padding-top:4px;background:url(btn.gif)}
</style>
</head>

<body>

<script language="javascript">
var np = <%=SEP_NP%>
var defh = "<%=SEP_HPath%>"
document.write("<table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr><td align=center valign=center>"
+"<table border=0 cellpadding=0 cellspacing=0><tr height=1><td width=1></td><td class=mainbo width=598></td><td width=1></td></tr><tr height=26><td class=mainbo></td><td><table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr height=1><td class=tttbl></td><td class=tttbm></td><td class=tttbr></td></tr><tr><td class=ttmbl></td><td class=ttmbm></td><td class=ttmbr align=right></td></tr></table></td><td class=mainbo></td></tr></table>"
+"<table border=0 cellpadding=1 cellspacing=0 width=600 height=400 class=mainbo><tr><td>"
+"<table border=0 cellpadding=5 cellspacing=0 width=100% height=100% class=mainbg>"
+"<tr height=69 class=maintbg><td><font class=TxtStep>");
document.write((np==0)?"Welcome":(np==4)?"Finish":"Step - "+np);
document.write("</font><br></td>"
+"<td align=right valign=top><font class=TxtTitle><%=SEP_PName%></font><br>"
+"<table border=0 cellpadding=0 cellspacing=0 height=100% width=240 align=right><tr height=1 class=mainbo><td></td></tr><tr align=right><td><font class=TxtInfo><%=SEP_SetupInfo(SEP_NP)%></font></td></tr></table>"
+"</td></tr><tr height=1 class=maintml><td colspan=2></td></tr><form name=bksform action=setup.asp method=post><input type=hidden name=Form_GP><tr><td colspan=2 valign=top>"
+"<table border=0 cellpadding=0 cellspacing=0 width=100%>");
</script>
<%
Select Case SEP_NP
	Case 0: PG0
	Case 1: PG1
	Case 2: PG2
	Case 3: PG3
	Case 4: PG4
End Select
%>
<script language="javascript">
document.write("</table></td></tr><tr height=36><td colspan=2 align=right>"
+"<input onmousedown=turn(1) onkeypress=turn(1) type=submit value=上一步 class=inpbtn <%=sep_btnd(0)%>> <input onmousedown=turn(2) onkeypress=turn(2) type=submit value=下一步 class=inpbtn <%=sep_btnd(1)%>> <input onmousedown=window.location='../' onkeypress=window.location='../' type=button value='完　成' class=inpbtn <%=sep_btnd(2)%>>"
+"</td></tr></form><tr height=1 class=maintml><td colspan=2></td></tr>"
+"<tr height=54 class=maintbg><td><table border=0 cellpadding=0 cellspacing=0 width=198><tr><td id=s1 class=StepUn><img src=s1.gif><br><%=SEP_IconInfo(0)%></td><td id=s2 class=StepUn><img src=s2.gif><br><%=SEP_IconInfo(1)%></td><td id=s3 class=StepUn><img src=s3.gif><br><%=SEP_IconInfo(2)%></td></tr></table></td>"
+"<td valign=bottom align=right><font class=TxtCopy>Run Time: <%=FormatNumber(cCur(Timer - DEF_PageExeTime1),4,True)*1000%> ms<br>LastUpdate: <%=SEP_PDate%><br>Copyright &copy; <%=Year(DEF_Now) & " " & SEP_Copyright%>, All rights reserved. <a href="+defh+" target=_blank><font class=TxtCopy>"+defh+"</font></a></font></td>"
+"</tr></table></td></tr></table></td></tr></table>");if(np>0&&np<4)document.all["s"+np].className="";
function turn(n){bksform.Form_GP.value=n}
</script>

</body>

</html>

<%
Function PG4
	
	Dim TempStr
	Session(DEF_MasterCookies & "BankSPR") = 0
	Response.Write "<tr height=30><td>" & SEP_MainInfo(4) & "</td></tr>"
	Response.Write "<tr height=22><td>"
	Response.Write "<b class=mTitle>安装程序已经完成，下面是一些常用信息</b>"
	Response.Write "</td></tr>"
	Response.Write "<tr><td>"
	TempStr = Request.Form("ErrorCode")
	If TempStr <> "" Then Response.Write "在安装过程中检测到错误，你可以点击<a href=http://ashi.cn/spct/go.asp?id=0?ec=" & TempStr & ">这里</a>查看详细信息。<br><br>"
	If SEP_Flag(0) = 0 Then	Response.Write SEP_NoFSOInfo & "<br>"
	Response.Write SEP_AfterSetupInfo
	Response.Write "</td></tr>"	
	
End Function

Function PG0
	
	Response.Write "<tr height=30><td>" & SEP_MainInfo(0) & "</td></tr>"
	Response.Write "<tr height=22><td>"
	Response.Write "<b class=mTitle>许可协议</b>"
	Response.Write "</td></tr>"
	Response.Write "<tr height=130><td valign=top>" & NullPic(20,1)
	Response.Write "<textarea cols=46 rows=6 class=txtara readonly>" & VbCrLf & SEP_CopyInfo & "</textarea><br>" & NullPic(1,3) & "<br>" & NullPic(20,1)
	If SEP_Flag(0) <> 1 Then
		Response.Write "<input type=radio value=2 checked name=Form_Agree>不同意 <input type=radio value=1 name=Form_Agree>同意此协议  - <font class=mTitle>您必须同意此协议才能继续安装</font>"
	Else
		Response.Write "<font class=mTitle>您已同意此协议</font>"
	End If
	Response.Write "</td></tr>"
	Response.Write "<tr height=22><td>"
	Response.Write "<b class=mTitle>相关站点</b>"
	Response.Write "</td></tr>"
	Response.Write "<tr height=22><td valign=top>" & NullPic(20,1)
	If SEP_FPath(0) <> "" Then Response.Write "<a href=" & SEP_HPath & SEP_FPath(0) & " target=_blank>插件官方</a> "
	If SEP_FPath(1) <> "" Then Response.Write "<a href=" & SEP_LPath & SEP_FPath(1) & " target=_blank>LeadBBS</a> "
	Response.Write "</td></tr>"
	
End Function

Function PG1
	
	Dim SEP_FSO,TempStr
	Response.Write "<tr height=30><td>" & SEP_MainInfo(1) & "</td></tr>"
	Response.Write "<tr height=22><td>"
	Response.Write "<b class=mTitle>组件检测</b>"
	Response.Write "</td></tr>"	
	If SEP_Flag(1) = 1 Then
		Set SEP_FSO = CreateObject(DEF_FSOString)
		Response.Write "<tr><td>" & NullPic(20,1)
		Response.Write "FSO 支持：确认"
		Response.Write "</td></tr>"
		Response.Write "<tr><td>" & NullPic(40,1)
		Response.Write "gafc 版银行："
		If SEP_FSO.FileExists(Server.Mappath("../plug-ins/bank/bank.asp")) Then
			Response.Write "已找到"
			SEP_Flag(2) = 1
		Else
			Response.Write "未找到"
			SEP_Flag(2) = 0
		End If
		Response.Write "</td></tr>"
		Response.Write "<tr><td>" & NullPic(40,1)
		Response.Write "LeadBBS Bank："
		SEP_Flag(3) = 0
		SEP_Flag(4) = 0
		If SEP_FSO.FileExists(Server.Mappath("../user/userbank.asp")) Then
			Response.Write "已找到 "
			Dim Fs,N,T,i
			Set Fs = SEP_FSO.OpenTextFile(Server.Mappath("../user/userbank.asp"),1)
			T = Fs.ReadAll
			i = inStr(T, "'Time Stamp Begin" & VbCrLf)
			If i Then
				T = Mid(T,i + 19)
				T = Mid(T,2,inStr(T,VbCrLf))
				T = Split(T,"_")
				If Ubound(T) = 4 Then
					If isNumeric(T(0)) Then
						SEP_Flag(3) = 1
						SEP_Flag(4) = T(0)
					End If
				End If
			Else
				T = Mid(T,22,3)
				If isNumeric(T) Then
					SEP_Flag(3) = 1
					SEP_Flag(4) = T
				End If
			End If
			If SEP_Flag(4) > 0 Then
				Response.Write "[版本" & FormatNumber(SEP_Flag(4),1,True) & "]"
				If SEP_Flag(4) >= cSng(SEP_PVer) Then
					TempStr = Array("","checked","")
				Else
					TempStr = Array("checked","","")
				End If
			Else
				Response.Write "[校验失败]"
				TempStr = Array("","checked","disabled")
			End If
			Set Fs = Nothing
		Else
			Response.Write "未找到"
			TempStr = Array("checked","","disabled")
		End If
		Response.Write "</td></tr>"
	Else
		Response.Write "<tr height=22><td valign=top>" & NullPic(20,1)
		Response.Write "FSO 支持：否"
		Response.Write "</td></tr>"
		Response.Write "<tr><td>" & NullPic(40,1)
		Response.Write "对不起，您的空间不能使用 FSO，请您使用手动安装功能。"
		Response.Write "</td></tr>"
		TempStr = Array("disabled","checked","")
	End If
	Session(DEF_MasterCookies & "SEP_Flag") = SEP_Flag
	Set SEP_FSO = Nothing
	Response.Write "<tr height=22><td>"
	Response.Write "<b class=mTitle>安装选择</b>"
	Response.Write "</td></tr>"
	Response.Write "<tr><td>" & NullPic(20,1)
	Response.Write "<input type=radio value=1 name=Form_InstallMode id=r1 " & TempStr(0) & "><label for=r1>标准安装</label> "
	Response.Write "<input type=radio value=2 name=Form_InstallMode id=r2 " & TempStr(1) & "><label for=r2>自定安装</label> "
	Response.Write "<input type=radio value=3 name=Form_InstallMode id=r3 " & TempStr(2) & "><label for=r3>卸载</label>"
	Response.Write "</td></tr>"
	
End Function

Function PG2
	
	Dim N,T
	Redim SEP_INS_Checked(SEP_INS_ItemNum)
	T = Left(Request.Form("Form_InstallMode"),1)
	Response.Write "<tr height=30><td>" & SEP_MainInfo(2) & "</td></tr>"
	Select Case T
		Case "3":
			Response.Write "<input name=Form_Mode type=hidden value=2>"
			Response.Write "<tr height=22><td>"
			Response.Write "<b class=mTitle>卸载确认</b>"
			Response.Write "</td></tr>"
			Response.Write "<tr><td>" & NullPic(20,1)
			Response.Write "<font class=mTitle>如果您确定要卸载 " & SEP_PName & " 请点击“下一步” 此过程将会很漫长</font>"
			Response.Write "</td></tr>"
		Case Else:
			If T = "1" Then
				SEP_INS_Checked(0) = "Checked onclick=this.checked=true"
				If SEP_Flag(4) = 0 Then
					SEP_INS_Checked(1) = "Checked onclick=this.checked=true"
				Else
					SEP_INS_Checked(1) = "disabled"
				End If
				If SEP_Flag(2) = 1 Then
					SEP_INS_Checked(2) = "Checked"
				Else
					SEP_INS_Checked(2) = "disabled"
				End If
			End If
			Response.Write "<input name=Form_Mode type=hidden value=1>"
			Response.Write "<tr height=22><td>"
			Response.Write "<b class=mTitle>组件选择</b>"
			Response.Write "</td></tr>"
			Response.Write "<tr><td>"
			Response.Write "<script language=""javascript"">" & VbCrLf
			Response.Write "iteminfotxt = new Array(""" & SEP_INS_ItemInfo(0) & """"
			For N = 1 To SEP_INS_ItemNum
				Response.Write ",""" & SEP_INS_ItemInfo(N) & """"
			Next
			Response.Write ");" & VbCrLf
			Response.Write "function info(n){iteminfo.innerHTML=iteminfotxt[n]}" & VbCrLf
			Response.Write "</script>"
			Response.Write "<table border=0 cellpadding=0 cellspacing=0 width=100% ><tr><td width=18>" & NullPic(18,1) & "</td>"
			Response.Write "<td><table border=0 cellpadding=3 cellspacing=1 width=100% height=160><tr><td valign=top class=txtara width=50% >"
			For N = 0 To SEP_INS_ItemNum
				Response.Write "<span onclick=info(" & N & ") style=cursor:hand><input type=checkbox value=1 name=Form_Item" & N & " " & SEP_INS_Checked(N) & ">" & SEP_INS_Item(N) & "</span><br>"
			Next
			Response.Write "</td><td valign=top class=txtara width=50% id=iteminfo>"
			Response.Write "</td></tr></table>"
			Response.Write "</td></tr></table>"
			Response.Write "</td></tr>"
			Response.Write "<script language=""javascript"">" & VbCrLf
			Response.Write "iteminfo.innerHTML=iteminfotxt[0]" & VbCrLf
			Response.Write "</script>"
	End Select
	
End Function

Function PG3

	Dim N,C,T,P,Mode
	Redim Form_Mode(SEP_INS_ItemNum)
	Mode = Request.Form("Form_Mode")
	Response.Write "<tr height=30><td>" & SEP_MainInfo(3) & "</td></tr>"
	If Mode = "2" Then
		If DelDatabase = 4 Then
			SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "数据库恢复成功！" & VbCrLf & VbCrLf
			C = C & "0"
		Else
			SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "数据库恢复失败！" & VbCrLf & VbCrLf
			C = C & "4"
			T = T + 1
		End If
		If CopyOldFile = 6 Then
			SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "文件恢复成功！"
			C = C & "0"
		Else
			SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "文件恢复失败！"
			C = C & "5"
			T = T + 1
		End If
	Else
		For N = 0 To SEP_INS_ItemNum
			Form_Mode(N) = Request.Form("Form_Item" & N)
			If Form_Mode(N) = "1" Then
				Form_Mode(N) = 1
			Else
				Form_Mode(N) = 0
			End If
		Next
		If Form_Mode(0) = 1 Then
			If CopyNewFile = 3 Then
				SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "文件复制成功！" & VbCrLf & VbCrLf
				C = C & "0"
			Else
				SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "文件复制失败！" & VbCrLf & VbCrLf
				C = C & "1"
				T = T + 1
			End If
		End If
		If Form_Mode(1) = 1 Then
			If UpDatabase = 7 Then
				SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "数据库更新成功！" & VbCrLf & VbCrLf
				C = C & "0"
			Else
				SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "数据库更新失败！" & VbCrLf & VbCrLf
				C = C & "2"
				T = T + 1
			End If
		End If
		If form_Mode(2) = 1 Then
			If UpBankData(Request.Form("gdbpath")) = 3 Then
				SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "GAFC 银行数据库更新成功！"
				C = C & "0"
			Else
				SEP_IMSG = SEP_IMSG & VbCrLf & VbCrLf & "GAFC 银行数据库更新失败！"
				C = C & "3"
				T = T + 1
			End If
		End If
	End If
	Response.Write "<tr height=22><td>"
	Response.Write "<b class=mTitle>更新进程</b>"
	Response.Write "</td></tr>"
	Response.Write "<tr><td>" & NullPic(20,1) & "<textarea cols=74 rows=10 class=txtara readonly>" & SEP_IMSG & "</textarea></td></tr>"
	If T > 0 Then
		Response.Write "<input type=hidden name=ErrorCode value=" & SEP_Flag(0) & SEP_Flag(1) & SEP_Flag(2) & SEP_Flag(3) & SEP_Flag(4) & "-" & Mode & "-" & C & ">"
	End If

End Function

Function GetPID
	
	SEP_Flag = Session(DEF_MasterCookies & "SEP_Flag")
	If isArray(SEP_Flag) = False Then
		Redim SEP_Flag(4)
	End If
	If isNumeric(SEP_Flag(1)) = False or isNull(SEP_Flag(1)) or SEP_Flag(1) = "" Then
		SEP_Flag(1) = FSFlag
	End If
	If isNumeric(SEP_Flag(0)) = False or isNull(SEP_Flag(0)) or SEP_Flag(0) = "" Then
		If Request.Form("Form_Agree") = "1" Then
			SEP_Flag(0) = 1
		End If
	End If
	Session(DEF_MasterCookies & "SEP_Flag") = SEP_Flag
	SEP_NP = Session(DEF_MasterCookies & "BankSPR")
	SEP_GP = Left(Request.Form("Form_GP"),1)
	If isNumeric(SEP_NP) = False or isNull(SEP_NP) or SEP_NP = "" Then SEP_NP = 0
	If isNumeric(SEP_GP) = False or isNull(SEP_NP) or SEP_NP = "" Then SEP_GP = 0
	Select Case SEP_GP
		Case 1: SEP_NP = SEP_NP - 1
		Case 2: SEP_NP = SEP_NP + 1
	End Select
	If SEP_NP < 0 Then SEP_NP = 0
	If SEP_NP > 4 Then SEP_NP = 4
	If SEP_Flag(0) <> 1 Then SEP_NP = 0
	Select Case SEP_NP
		Case 0: SEP_BtnD = Array("disabled","","disabled")
		Case 1,2,3: SEP_BtnD = Array("","","disabled")
		Case 4: SEP_BtnD = Array("disabled","disabled","")
	End Select
	Session(DEF_MasterCookies & "BankSPR") = SEP_NP
	
End Function

Function NullPic(w,h)
	
	NullPic = "<img src=" & DEF_BBS_HomeUrl & "images/null.gif width=" & w & " height=" & h & ">"
	
End Function

Function FSFlag
	
	On Error Resume Next
	Dim Fs
	FSFlag = 1
	If DEF_FSOString <> "" Then
		Set Fs = CreateObject(DEF_FSOString)
		If err <> 0 Then
			Err.Clear
			FSFlag = 0
		End If
		Set Fs = Nothing
	Else
		FSFlag = 0
	End If
	
End Function

Function UpDatabase
	
	OpenDatabase
	On Error Resume Next
	Dim SQL,C
	SEP_IMSG = SEP_IMSG & "下面开始升级数据库..." & VbCrLf
	
	SQL = "ALTER TABLE LeadBBS_User ADD SavePoints int"
	Con.Execute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：创建字段SavePoints失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：创建字段SavePoints成功"
		C = C + 1
	End If
	SQL = "ALTER TABLE LeadBBS_User ALTER COLUMN SavePoints FLOAT Default 0"
	Con.ExeCute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：建立SavePoints默认值失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：建立SavePoints默认值成功"
		C = C + 1
	End If
	SQL = "CREATE INDEX SavePoints ON LeadBBS_User(SavePoints)"
	Con.Execute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：创建索引SavePoints失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：创建索引SavePoints成功"
		C = C + 1
	End If
	SQL = "Update LeadBBS_User Set SavePoints=0"
	Con.ExeCute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：更新SavePoints数据失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：更新SavePoints成功"
		C = C + 1
	End If
	SQL = "ALTER TABLE LeadBBS_User ADD SaveDate float"
	Con.Execute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：创建字段SaveDate失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：创建字段SaveDate成功"
		C = C + 1
	End If
	SQL = "ALTER TABLE LeadBBS_User ALTER COLUMN SaveDate FLOAT Default 20000101010101"
	Con.ExeCute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：建立SaveDate默认值失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：建立SaveDate默认值成功"
		C = C + 1
	End If
	SQL = "Update LeadBBS_User Set SaveDate=20000101010101"
	Con.ExeCute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：更新SaveDate数据失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：更新SaveDate成功"
		C = C + 1
	End If
	UpDatabase = C
	CloseDatabase
	
End Function

Function CopyNewFile
	
	On Error Resume Next
	Dim Fs,N,C
	Dim SEP_FSO
	Set SEP_FSO = CreateObject(DEF_FSOString)
	Redim T(1)
	SEP_IMSG = SEP_IMSG & "下面开始复制新的文件..." & VbCrLf
	SEP_FSO.CopyFolder Server.Mappath("user"),Server.Mappath("../user"),true
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能复制 User 目录：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：复制 User 目录成功"
		C = C + 1
	End If
	SEP_FSO.CopyFolder Server.Mappath("Manage"),Server.Mappath("../" & DEF_ManageDir),true
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能复制 " & DEF_ManageDir & " 目录：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：复制 " & DEF_ManageDir & " 目录成功"
		C = C + 1
	End If
	SEP_FSO.CopyFolder Server.Mappath("inc"),Server.Mappath("../inc"),true
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能复制 inc 目录：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：复制 inc 目录成功"
		C = C + 1
	End If
	CopyNewFile = C
	
End Function

Function DelDatabase

	Server.ScriptTimeout=99999
	OpenDatabase
	On Error Resume Next
	Dim SQL,C
	SEP_IMSG = SEP_IMSG & "下面开始恢复数据库..." & VbCrLf
	
	SQL = "Update LeadBBS_user Set Points=Points+SavePoints"
	Con.Execute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：结算存款失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：结算存款成功"
		C = C + 1
	End If
	SQL = "ALTER TABLE LeadBBS_User DROP CONSTRAINT SavePoints"
	Con.Execute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：删除字段SavePoints索引失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：删除字段SavePoints索引成功"
		C = C + 1
	End If
	SQL = "ALTER TABLE LeadBBS_User DROP SavePoints"
	Con.Execute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：删除字段SavePoints失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：删除字段SavePoints成功"
		C = C + 1
	End If
	SQL = "ALTER TABLE LeadBBS_User DROP SaveDate"
	Con.Execute(SQL)
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：删除字段SaveDate失败：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：删除字段SaveDate成功"
		C = C + 1
	End If
	DelDatabase = C
	CloseDatabase

End Function

Function CopyOldFile
	
	On Error Resume Next
	Dim C
	Dim SEP_FSO
	Set SEP_FSO = CreateObject(DEF_FSOString)
	SEP_IMSG = SEP_IMSG & "下面开始恢复文件..." & VbCrLf

	SEP_FSO.DeleteFile Server.Mappath("../user/userbank.asp")
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能删除银行主程序：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：删除银行主程序成功"
		C = C + 1
	End If
	SEP_FSO.DeleteFile Server.Mappath("../inc/bank_setup.asp")
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能删除银行配置文件：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：删除银行配置文件成功"
		C = C + 1
	End If
	SEP_FSO.DeleteFile Server.Mappath("../" & DEF_ManageDir & "/user/banksetup.asp")
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能删除银行管理程序：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：删除银行管理程序成功"
		C = C + 1
	End If
	SEP_FSO.DeleteFile Server.Mappath("../" & DEF_ManageDir & "/user/banklog.asp")
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能删除银行日志察看程序：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：删除银行日志察看程序成功"
		C = C + 1
	End If
	SEP_FSO.CopyFolder Server.Mappath("userold"),Server.Mappath("../user"),true
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能恢复 User 目录：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：恢复 User 目录成功"
		C = C + 1
	End If
	SEP_FSO.CopyFolder Server.Mappath("Manageold"),Server.Mappath("../" & DEF_ManageDir),true
	If Err Then
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：未能恢复 " & DEF_ManageDir & " 目录：" & err.description
		err.Clear
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：恢复 " & DEF_ManageDir & " 目录成功"
		C = C + 1
	End If
	CopyOldFile = C
	
End Function
	
Function UpBankData(bankdb)

	Dim tcon,C
	Dim SL,DL,Rs,Rs2

	OpenDatabase
	On Error Resume Next
	Server.ScriptTimeout=99999
	
	SEP_IMSG = SEP_IMSG & "下面开始升级Gafc版银行数据库..." & VbCrLf
	
	Set tcon = Server.CreateObject("ADODB.Connection")
	tcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../" & bankdb)
	tcon.open
	If Err Then
		Set tcon = Nothing
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：银行数据库连接错误：" & err.description
		Err.Clear
		Exit Function
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：银行数据库连接成功"
		C = C + 1
	End If

	Set Rs2 = Server.CreateObject("ADODB.RecordSet")
	Rs2.Open "Select * from bank_config",tcon,1,3
	If Err Then
		Rs2.Close
		Err.Clear
		Rs2.Open "Select * from info",tcon,1,3
	End If
	If Err Then
		Set Rs2 = Nothing
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作失败：银行数据库检测错误：" & err.description
		Err.Clear
		Exit Function
	Else
		SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：银行数据库检测成功"
		C = C + 1
	End If
	SL = cCur(Rs2(0))/100
	DL = cCur(Rs2(1))/100
	Rs2.close
	
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Rs2.Open "Select * from bank where savemoney>0 or daikuang>0",tcon,1,3
	Do while Not Rs2.Eof
		Rs.Open "Select top 1 * from LeadBBS_User where username='" & Replace(Rs2("UserName"),"'","''") & "'",con,1,3
		If Not Rs.Eof Then
			Rs("SavePoints") = Rs("SavePoints") + fix(cCur(Rs("SavePoints")) * DEF_UserDayPoints * fix(datediff("h",RestoreTime(Rs("SaveDate")),DEF_Now)/24))
			Rs("SavePoints") = Rs("SavePoints") + Rs2(2) + fix(RS2(2)*SL*datediff("d",Rs2(4),DEF_Now)) - Rs2(3) - Rs2(3) * DL * datediff("d",Rs2(5),DEF_Now)
			Rs("SaveDate") = GetTimeValue(DEF_Now)
			If cCur(Rs("SavePoints")) < 0 then Rs("SavePoints")=0
			Rs.Update
		End if
		Rs.Close
		Rs2.MoveNext
	Loop
	Rs2.Close
	SEP_IMSG = SEP_IMSG & VbCrLf & "操作成功：银行数据库升级成功"
	C = C + 1
	UpBankData = C
	
	tcon.Close
	Set tcon = Nothing
	CloseDatabase
		
End Function
%>