<!--#include file = admin_conn.asp -->
<!--#include file = titleb.asp -->
<%
conn.close
set conn=nothing


upmdb=trim(request("upmdb"))
if upmdb="" then upmdb=xuasmdb

set conn=server.CreateObject("adodb.connection")
DBPath = Server.MapPath(upmdb)
conn.open "provider=microsoft.jet.oledb.4.0; data source="&DBpath

ver="3.0"
%>
<head>
<STYLE type="text/css">
<!--
a:link {text-decoration: none; font-family: AdobeSm; color: #000000 }
a:visited {text-decoration: none; color: #000000 }
A:hover {COLOR: green; FONT-FAMILY: Verdana, 宋体, MingLiU; 
TEXT-DECORATION: underline
}
body {font-size: 9pt; font-family: Verdana,宋体,MingLiU, Arial;color: #000000}
TD {FONT-SIZE: 9pt; FONT-FAMILY: Verdana, 宋体, MingLiU, Arial;
color: #000000;line-height: 120%;table-layout:fixed;word-break:break-all
}
p {FONT-SIZE: 9pt; FONT-FAMILY: Verdana, 宋体, MingLiU, Arial;
color: #000000
}
input {FONT-SIZE: 9pt; FONT-FAMILY: Verdana, 宋体, MingLiU, Arial;
color: #000000
}
body {margin-top: 0; margin-bottom: 0;margin-left:0;margin-right:0; color: #000000}
select {FONT-SIZE: 9PT;font-family: Verdana,宋体}
option {FONT-SIZE: 9pt;font-family: Verdana,宋体}
textarea {FONT-SIZE: 9pt;font-family: Verdana,宋体}
-->
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<BR><BR>
<%
sss=LCase(request.servervariables("QUERY_STRING"))
   if instr(sss,"select")<>0 or instr(sss,"inster")<>0 or instr(sss,"delete")<>0 or instr(sss,"(")<>0 or instr(sss,"'or")<>0 then
     response.write "<BR><BR><center>你的网址不合法"
     response.end
   end if


%>
<div align="center">
	<table border="0" cellpadding="3" cellspacing="0" width="700" id="table1">
		<tr>
			<td>
			<p align="center"><b><font size="3" color="#FF0000">讯时系统升级程序</font></b></p>
			<p>　　即将开始为你的数据库升级到<%=ver%>版本，强烈建议你首先备份数据库，然后再进行升级，在升级过程中，不能对正在使用的数据库进行操作，推荐使用备份数据库进行升级。</p>
			<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="VBScript" Type="text/vbscript"><!--
function FrontPage_Form1_onsubmit()
  Set theForm = document.FrontPage_Form1

  If (theForm.upd.selectedIndex < 0) Then
    MsgBox "请选择“请选择你的数据库版本”选项中的一项。", 0, "有效性验证错误"
    theForm.upd.focus()
    FrontPage_Form1_onsubmit = False
    Exit Function
  End If

  If (theForm.upd.selectedIndex = 0) Then
    MsgBox "第一个“请选择你的数据库版本”选项无效。 请选择其他选项中的一项。", 0, "有效性验证错误"
    theForm.upd.focus()
    FrontPage_Form1_onsubmit = False
    Exit Function
  End If
  FrontPage_Form1_onsubmit = True 
End Function
--></script><!--webbot BOT="GeneratedScript" endspan --><form method="POST" action="<%=request.servervariables("URL")%>" name="FrontPage_Form1">
				<p align="center">
				数据库路径：<input type="text" name="upmdb" value='<%=xuasmdb%>' size="20"><br><br>&nbsp;<!--webbot bot="Validation" s-display-name="请选择你的数据库版本" b-value-required="TRUE" b-disallow-first-item="TRUE" --><select size="1" name="upd">
				<option>请选择....</option>
				<option value="14">2.8/2.9版本升级到<%=ver%></option>
				<option value="13">2.7版本升级到<%=ver%></option>
				<option value="12">2.5/2.6版本升级到<%=ver%></option>
				<option value="11">2.4版本升级到<%=ver%></option>
				<option value="10">2.3版本升级到<%=ver%></option>
				<option value="9">2.2版本升级到<%=ver%></option>
				<option value="8">2.1版本升级到<%=ver%></option>
				<option value="7">2.0版本升级到<%=ver%></option>
				<option value="6">1.9版本升级到<%=ver%></option>
				<option value="5">1.85版本升级到<%=ver%></option>
				<option value="4">1.51版本升级到<%=ver%></option>
				<option value="3">1.40版本升级到<%=ver%></option>
				<option value="2">1.36版本升级到<%=ver%></option>
				<option value="1">1.33或更早版本升级到<%=ver%></option>
				</select>　　<input type="submit" value="升级" name="B1"></p>
			</form>
			<p align="center">　</td>
		</tr>
		<tr>
			<td>

<%
ON ERROR RESUME NEXT
upd=trim(Request("upd"))

if upd<>"" then
	
	upd=int(upd)
	
	
	'1    1.33版本
	if upd=1 then
		conn.execute "ALTER TABLE lm add lm2 text(255),lmid text(255)"
		conn.execute "ALTER TABLE news add adduser text(255),xgnews text(255)"
		conn.execute "ALTER TABLE news add lm2 text(255)"
		conn.execute "ALTER TABLE admin add dj text(255),lmid text(255)"
		Conn.execute "create table newspl (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,email text(255),content memo,addtime datetime,username text(255),newsid int,sh int,ip text(255))"
		Conn.execute "create table webgg (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),content memo,addtime datetime,adduser text(255))"
		conn.Execute "update [news] set [lm2]='0'"
	end if
	
	' 2 　1.36版本
	if upd<=2 then
		conn.execute "ALTER TABLE newsmb add lmname int,newstime int,newshit int"
	end if
	
	
	'3 －－1.40版本
	if upd<=3 then
		Conn.execute "create table config (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,path text(255),sotop memo,sobottom memo,tgtop memo,tgbottom memo)"
		Conn.execute "create table tpip (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,ip text(255),addtime datetime,tpid int)"
		Conn.execute "create table webgg (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),content memo,addtime datetime,adduser text(255))"
		Conn.execute "create table tp (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),vtp text(255))"
		
		for i=1 to 15
			aaa="tp"&i
			bbb="tp"&i&"h"
			conn.execute "ALTER TABLE tp add "&aaa&" text(255),"&bbb&" int"
		next
		
		conn.Execute "insert into [config] ([sotop]) values('1')"
		Conn.execute "create table UserTouGao (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),adduser text(255),addtime datetime,ip text(50),content memo)"
		conn.execute "ALTER TABLE lm add pic int"
		conn.execute "ALTER TABLE lm add fontcolor text(255)"
		conn.Execute "update [news] set [ontop]=3 "
	end if
	
	
	'4－－1.51版本
	if upd<=4 then
		conn.execute "ALTER TABLE newsmb add icon memo"
	    conn.execute "ALTER TABLE newsmb add updown int"
	    conn.execute "ALTER TABLE link add js memo,ontop int,upd datetime"
		conn.execute "ALTER TABLE config add TGhtmledit int"
		conn.execute "ALTER TABLE newsmb add openwindow int"
		conn.execute "ALTER TABLE newsmb add tb int"
		aaa="ok"
	end if
	
	
	'5－－1.85版本
	if upd<=5 then
	
		Conn.execute "create table ly (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),adduser text(255),ip text(255),hftime datetime,addtime datetime,email text(200),sh int,sex text(200),tx text(200),content memo)"
		
		conn.execute "ALTER TABLE news add htitle text(255)"
		conn.execute "ALTER TABLE news add lm3 text(200)"
		conn.execute "ALTER TABLE lm add lm3 text(200)"
		
		conn.Execute "update [news] set [htitle]='&nbsp;',[lm3]='0' "
		aaa="ok"
	end if
	
	
	'6－－1.90版本
	if upd<=6 then
	
		conn.execute "ALTER TABLE ly add bm text(255)"
		conn.execute "ALTER TABLE config add newsx int"
		conn.execute "ALTER TABLE config add pl int"
		conn.execute "ALTER TABLE config add moreline int"
		Conn.execute "create table blog (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,content memo,addtime datetime)"
		conn.execute "ALTER TABLE config add picw int,pich int,picx int,picy int"
		conn.execute "ALTER TABLE config add picmbtop memo,picmbdown memo"
		conn.execute "ALTER TABLE config add picpagew int"
		conn.execute "ALTER TABLE config add pictitle int,pictitlecolor text(255),pictitlesize text(255)"
		aaa="ok"
	end if
	
	
	
	'7－－2.0版本
	if upd<=7 then
		conn.execute "ALTER TABLE config add XuasGG int"
		conn.execute "ALTER TABLE config add XuasGGWZ int"
		conn.execute "ALTER TABLE config add ggso int"
		conn.execute "ALTER TABLE config add plfb int"
		conn.execute "ALTER TABLE lyhf add lyid int"
		conn.execute "ALTER TABLE config add Tglm memo"
		conn.execute "ALTER TABLE usertougao add lmid text(255)"
	
		conn.Execute "update [config] set [XuasGG]=1,[XuasGGwz]=2,[GGso]=1,[plfb]=1,[tglm]='1,2,3' "
		conn.Execute "update [usertougao] set [lmid]='0'"
		
		
		aaa="ok"
	
	end if
	
	
	'8 　2.1版本开始升级
	if upd<=8 then
		conn.execute "ALTER TABLE admin add NewsSL int"
		conn.Execute "update [admin] set [NewsSL]=0 "
		conn.execute "ALTER TABLE news add sh int"
		conn.Execute "update [news] set [sh]=1 "
		aaa="ok"
	end if
	
	'9 　2.2版本开始升级
	if upd<=9 then
		conn.execute "ALTER TABLE ly add LB int"
		conn.Execute "update [ly] set [lb]=0 "
		Conn.execute "create table LyLB (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,lb text(255))"
		conn.Execute "insert into [lylb] ([lb]) values('一般留言')"
		Conn.execute "drop table tp"
		Conn.execute "drop table tpip"
		Conn.execute "create table TP (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),DD int,addtime datetime,endtime datetime)"
		Conn.execute "create table TPtitle (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,tpxx text(255),tps int,tpid int,tplink memo)"
		Conn.execute "create table TP (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),content memo,addtime datetime)"
		conn.execute "ALTER TABLE [config] add ZuZiIP memo"
		aaa="ok"
	end if
	
	
	'10 　2.3版本开始升级
	if upd<=10 then
		conn.execute "ALTER TABLE [NewsMB] add listtumb memo"
		conn.execute "ALTER TABLE [NewsMB] add picw int,pich int,picx int,picy int,pictitle int,pictitlecolor text(200),pictitlesize text(200)"
		conn.Execute "update [NewsMB] set [picw]=120,[pich]=100,picx=4,picy=4,pictitle=18,pictitlecolor='000000',pictitlesize='9' "
		conn.execute "ALTER TABLE [ly] add SH int"
		conn.close:set conn=nothing
		set conn=server.CreateObject("adodb.connection")
		DBPath = Server.MapPath(xuasmdb)
		conn.open "provider=microsoft.jet.oledb.4.0; data source="&DBpath
		conn.execute "alter table [config] drop column picx,picy,picw,pich,pictitle,pictitlecolor,pictitlesize,picmbtop,picmbdown"
		conn.execute "ALTER TABLE [config] add LYSH int"
		conn.execute "ALTER TABLE [config] add lrySH int"
		conn.Execute "update [config] set [lrysh]=0,[lysh]=0 "
		aaa="ok"
	end if
	
	'11  2.4版本开始升级
	if upd<=11 then
		Conn.execute "create table NewsZT (id COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,title text(255),MB memo,icon text(255))"
		conn.execute "ALTER TABLE [News] add ZTID int"
		aaa="ok"
	end if
	
	
	'12  2.5/2.6版本开始升级
	if upd<=12 then
		conn.execute "ALTER TABLE [News] add GoogleMap text(255)"
		conn.execute "ALTER TABLE [News] add filename text(255)"
		conn.execute "alter table [news] drop column updat"
		conn.execute "alter table [news] drop column file_path"
		conn.execute "alter table [news] drop column file_name"
		conn.execute "ALTER TABLE [News] add updat int"
		conn.execute "ALTER TABLE [News] add shUsername text(255)"
		conn.Execute "update [news] set [filename]='0',[updat]=[ID] " 
		
		aaa="ok"
	end if	


	'13  2.7版本开始升级
	if upd<=13 then
		conn.execute "ALTER TABLE [News] add piczz text(255)"
		conn.execute "ALTER TABLE [News] add LaiYuan text(255)"
		conn.Execute "update [news] set [zz]=' ' where zz='' or zz='&nbsp;' or zz is null "
		conn.Execute "update [news] set [laiyuan]=' ' where laiyuan='' or laiyuan='&nbsp;' or laiyuan is null "
		conn.Execute "update [news] set [piczz]=' ' where piczz='' or piczz='&nbsp;' or piczz is null "		
		
		aaa="ok"
	end if	
	
	' 2.8版本开始升级
	if upd<=14 then 
		conn.execute "ALTER TABLE [News] add piczz text(255)"
		conn.execute "ALTER TABLE [News] add LaiYuan text(255)"
		conn.Execute "update [news] set [zz]=' ' where zz='' or zz='&nbsp;' or zz is null "
		conn.Execute "update [news] set [laiyuan]=' ' where laiyuan='' or laiyuan='&nbsp;' or laiyuan is null "
		conn.Execute "update [news] set [piczz]=' ' where piczz='' or piczz='&nbsp;' or piczz is null "	
		set fso=server.CreateObject("Scripting.FileSystemObject")   
		fso.DeleteFile server.MapPath("admin_code_ls.asp"),true    
		fso.DeleteFile server.MapPath("Admin_Style.css"),true    
		fso.DeleteFile server.MapPath("admin_jf.asp"),true   
		fso.DeleteFile server.MapPath("admin_news_view.asp"),true  
		fso.DeleteFile server.MapPath("newstg.asp"),true
		fso.DeleteFile server.MapPath("newstg-save.asp"),true
 
		set fso=nothing		
		
		aaa="ok"				
	end if
	
end if

	conn.close
	set conn=nothing



%>
			</td>
		</tr>
		<tr>
			<td align=center>
			
			<% 
			if aaa="ok" then Response.Write "升级到"&ver&"版成功，请删除此升级文件，然后上传相关程序文件，请不要上传数据库文件！"&upd
			%>
			</td>
		</tr>
	</table>
</div>
<BR><BR>
<hr size=1>
<div align="center"><font face="Verdana">讯时科技　<a target="_blank" href="http://www.xuas.com">www.xuas.com</a>　热忱为你服务<BR>
	E-mail:alanxua@xuas.com　论坛：<a target="_blank" href="http://bbs.xuas.com">http://bbs.xuas.com</a></font></p>