新云网站管理系统(华西网域风格）v2.1 sp1升级程序

<% Response.Buffer = True On Error Resume Next Server.ScriptTimeout=9999999 Dim Conn,db,ConnStr Dim tConn,tConnStr,DBPath Dim Rs,SQL,i,n,IsSqlData,DatabaseVersion Dim TableTop,TableEnd Dim FoundErr FoundErr = False TableTop="

" TableEnd="

" Select Case LCase(Request("Action")) Case "step1" Step1() Case "step2" Step2() Case "step3" Step3() Case Else Step1() End Select If IsObject(Conn) Then Conn.Close Set Conn = Nothing End If Sub ConnectionDatabase() Dim SqlDatabaseName,SqlPassword,SqlUsername,SqlLocalName IsSqlData = ChkNumeric(Request.Form("IsSqlData")) If Len(Session("ConnData")) < 10 Then If IsSqlData = 1 Then SqlDatabaseName = Trim(Request.Form("data")) '数据库名 SqlUsername = Trim(Request.Form("username")) '用户名 SqlPassword = Trim(Request.Form("password")) '用户密码 SqlLocalName = Trim(Request.Form("source")) '连接名（本地用local，外地用IP） ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";" Else db = Replace(Request.Form("dbPath"), "'", "") Connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db) End If Session("ConnData") = Connstr Else ConnStr = Session("ConnData") End If On Error Resume Next Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open Connstr If Err Then Err.Clear Set Conn = Nothing Response.Write ("

数据库连接出错，
请检查您的数据库连接是否正确。

") Session("ConnData") = "" Response.End End If End Sub Sub Step1() Session("ConnData") = "" %>

新云网站管理系统(华西网域风格） v2.0.0 To v2.1 sp1升级程序
+ 操作说明，请仔细阅读操作说明后进行操作： 1、注意：本程序适合于新云v2.0.0、v2.0.0 sp1和v1.02 ACCESS版的升级；请检查你目前使用的程序版本再升级；强烈建议您在本地升级，升级完成后再上传到你的服务器，在升级前做好数据库备份工作。 2、ACCESS数据库升级请把您需要升级的数据库从WEB空间下载到本地和升级程序放在同一目录，运行update.asp开始升级。 3、如升级过程出错，或出现错误信息提示，请仔细阅读，一般都包含了解决办法，这时或许需要您手动调整部分信息，或者替换数据库重新再试。 4、升级完成后，请用ACCESS压缩数据库的再上传到你的WEB空间database目录，然后上传所有的v2.1 sp1的程序文件覆盖原程序的所有文件(图片文件可以不用上传)。如果你修改或者增加了内部频道，请对应该相关目录上传，然后打开config.asp修改频道ID 5、打开conn.asp修改数据库连接路径，登陆后台重建系统缓存；其它设置不变。 6、欢迎访问新云论坛(bbs.newasp.net)，就您使用新云网站管理系统(华西网域风格）的问题发表您的意见。 多谢大家一直以来对新云的支持，相信我们会做得更好！
请选择数据库类型 ACCESS 数据库 SQL数据库用户名： SQL数据库 密 码： SQL数据库 名 称： SQL数据库服务器： 数据库路径：(请使用相对路径) 数据库版本 v2.0.0/sp1 v1.02

Powered By ：NewCloud Content Management System Version 2.1 sp1 Copyright ©2003 - 2006 Newasp.Net

<% End Sub Sub Step2() Call ConnectionDatabase DatabaseVersion = ChkNumeric(Request("DatabaseVersion")) Call UpdateDatabaseTable() Response.Write TableTop If Not FoundErr Then Response.Write "" Response.Write "" Response.Write "" End If Response.Write TableEnd End Sub Sub Step3() Call ConnectionDatabase Response.Write "

" End Sub '删除表通用函数 Sub DelTable(TableName) On Error Resume Next Conn.Execute("Drop Table "&TableName&"") If Err Then Err.Clear() End If End Sub '----添加字段通用函数 Sub AddColumn(TableName,ColumnName,ColumnType) On Error Resume Next Conn.Execute("Alter Table "&TableName&" Add "&ColumnName&" "&ColumnType&"") If Err Then Response.Write TableTop & "新建 "&TableName&" 表中字段错误，请手动将数据库中 "&ColumnName&" 字段建立，属性为 "&ColumnType&"，原因" & Err.Description & "
" & TableEnd Err.Clear Response.Flush Else Response.Write TableTop & "新建 "&TableName&" 表中字段 "&ColumnName&" 成功
" & TableEnd Response.Flush End If End Sub Function ChkAddColumn(TableName,ColumnName,ColumnType) On Error Resume Next Conn.Execute("Alter Table "&TableName&" Add "&ColumnName&" "&ColumnType&"") If Err Then ChkAddColumn = False Err.Clear Else ChkAddColumn = True End If End Function '检查数据表是否存在 Function Checktable(TableName) On Error Resume Next Conn.Execute("SELECT * FROM " & TableName) If Err.Number <> 0 Then Err.Clear() Checktable = False Else Checktable = True End If End Function Function checkColumn(TableName,ColumnName) On Error Resume Next Conn.Execute("SELECT " & ColumnName & " FROM " & TableName) If Err.Number <> 0 Then Err.Clear() checkColumn = False Else checkColumn = True End If End Function '----过滤非法字符 Function CheckStr(str) If Isnull(str) Then CheckStr = "" Exit Function End If str = Replace(str,Chr(0),"") CheckStr = Replace(str,"'","''") End Function Sub UpdateDatabaseTable() On Error Resume Next If Not Checktable("NC_ShopList") Then Call addSiteCountTable Call addCardTable Call addCustomLabelTable Conn.Execute("UPDATE NC_SoftList SET isUpdate=1") If ChkAddColumn("NC_Config","PreviewSetting","nvarchar (255)") Then Conn.Execute ("UPDATE NC_Config SET PreviewSetting='999,1,2,110,90,www.newasp.cn,12,#FF0000,Arial,0,images/WaterMap.gif,0.8,#0066FF,100,35,0'") End If AddColumn "NC_DownAddress","DownText","nvarchar (255)" AddColumn "NC_Classify","AdsCode","ntext NULL" AddColumn "NC_Classify","stopad","smallint NOT NULL default 0" '--sp1新增加表 AddColumn "NC_Config","siteAdsCode","ntext NULL" AddColumn "NC_DownServer","IsOuter","smallint NOT NULL default 0" AddColumn "NC_DownServer","selfont","nvarchar (255)" AddColumn "NC_Config","ThunderPid","ntext NULL" AddColumn "NC_DownServer","AllDownHits","int NOT NULL default 0" AddColumn "NC_DownServer","DayDownHits","int NOT NULL default 0" AddColumn "NC_DownServer","HitsTime","datetime default Now()" '更新数据表 Conn.Execute("UPDATE NC_Config SET siteAdsCode='|||||||||||||||',ThunderPid=''") Conn.Execute("UPDATE NC_DownServer SET IsOuter=0,AllDownHits=0,DayDownHits=0,HitsTime=Now()") '---- Conn.Execute("UPDATE NC_DownAddress SET DownText='立即下载'") Conn.Execute("UPDATE NC_Classify SET AdsCode='|||||||||||||||',stopad=0") Conn.Execute("UPDATE NC_SoftList SET isUpdate=0 WHERE DownAddress='|||'") If Err.Number <> 0 Then Err.Clear() End If If DatabaseVersion = 0 Then Call UpdateTemplate() Else Call Update102Database() End If Else Response.Write TableTop & Err.Description &"（对不起！你使用的非新云官方数据库，本次升级失败。如果有什么问题请联系新云网络）" & TableEnd Response.Flush FoundErr = True End If End Sub Sub UpdateTemplate() Dim page_content,page_setting,ArrayContent,chanid Dim ArraySetting Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT TemplateID,ChannelID,skinid,pageid,page_content,page_setting FROM [NC_Template] WHERE isDefault=1" Rs.Open SQL,Conn,1,1 If Not(Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF ArraySetting = Split(Rs("page_setting"), "|||") page_setting = ChkNumeric(ArraySetting(0)) If UBound(ArraySetting) < 1 Then page_setting = 1 If page_setting = 1 And Rs("pageid")<>0 Then page_content = "{$NewaspLabel_Header}" & vbNewLine & Replace(Rs("page_content"), "|||@@@|||", vbNewLine & "{$NewaspLabel_Bottom}|||@@@|||{$NewaspLabel_Header}" & vbNewLine) & vbNewLine & "{$NewaspLabel_Bottom}" UpdateContent Rs("TemplateID"),page_content Response.Write TableTop & Rs("TemplateID") & "、更新模板成功...
" & TableEnd Response.Flush End If If Rs("pageid") = 0 Then ArrayContent = Split(Rs("page_content"), "|||") SQL = "Insert Into NC_CustomLabel (ChannelID,LabelName,readme,content,estop,NotAllow) values" &_ "(0,'Header','模板顶部通用标签,请将此标签复制到模板内容开始的位置'," &_ "'" & CheckStr(ArrayContent(1)) & "',0,1)" Conn.Execute(SQL) SQL = "Insert Into NC_CustomLabel (ChannelID,LabelName,readme,content,estop,NotAllow) values" &_ "(0,'Bottom','模板底部通用标签,请将此标签复制到模板内容结束的位置'," &_ "'" & CheckStr(ArrayContent(2)) & "',0,1)" Conn.Execute(SQL) Conn.Execute ("UPDATE NC_Template SET page_content='" & CheckStr(ArrayContent(0)) & "' WHERE TemplateID=" & Rs("TemplateID")) Response.Write TableTop & "更新自定标签成功
" & TableEnd Response.Flush End If Rs.movenext Loop End If Rs.Close:Set Rs = Nothing End Sub Function UpdateContent(ByVal TemplateID,ByVal str) Dim rs2,upsql On Error Resume Next If Len(str) = 0 Then Exit Function If TemplateID < 1 Then Exit Function Set rs2 = Server.CreateObject("ADODB.Recordset") upsql = "SELECT * FROM NC_Template WHERE TemplateID="& CLng(TemplateID) rs2.Open upsql,Conn,1,3 rs2("page_content").Value = str rs2.Update rs2.Close:Set rs2 = Nothing End Function Sub Update102Database() On Error Resume Next Call CreateDataTable() DBPath = "data/newasp.mdb" '默认连接请不要修改 tConnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(DBPath) '------------------------------------------------------------------------------- Set tConn = Server.CreateObject("ADODB.Connection") tConn.Open tConnStr If Err Then Err.Clear Set tConn = Nothing Response.Write ("数据库连接出错，
请打开update.asp检查连接字串。") Response.End End If Dim SkinRs,TemplateDir,newskinid Dim TemplateFields,TemplateValues Set SkinRs = Conn.Execute("SELECT MAX(skinid) FROM [NC_Template] WHERE pageid = 0") If Not (SkinRs.EOF And SkinRs.bof) Then newskinid = SkinRs(0) End If If IsNull(newskinid) Then newskinid = 0 SkinRs.Close newskinid = newskinid + 1 Set Rs = tConn.Execute("SELECT * FROM NC_Template ORDER BY ChannelID ASC,TemplateID ASC") If Not (Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF If Not IsNull(Rs("TemplateDir")) Then TemplateDir = CheckStr(Rs("TemplateDir")) Else TemplateDir = "" End If TemplateFields = "ChannelID,skinid,pageid,TemplateDir,page_name,page_content,page_setting,Template_Help,isDefault" TemplateValues = "" & Rs("ChannelID") & ","& newskinid &"," & Rs("pageid") & ",'" & TemplateDir & "','" & CheckStr(Rs("page_name")) & "','" & CheckStr(Rs("page_content")) & "','" & CheckStr(Rs("page_setting")) & "','" & CheckStr(Rs("Template_Help")) & "',1" SQL = "insert into [NC_Template](" & TemplateFields & ")values(" & TemplateValues & ")" Conn.Execute (SQL) Rs.movenext Loop End If Set Rs = Nothing Dim neworders Set Rs = Conn.Execute ("SELECT MAX(orders) FROM NC_Channel") If Not (Rs.EOF And Rs.bof) Then neworders = Rs(0) End If If IsNull(neworders) Then neworders = 0 Set Rs = Nothing Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM NC_Channel" Rs.Open SQL,Conn,1,3 Rs.Addnew Rs("ChannelID") = 5 Rs("orders") = neworders + 1 Rs("ColorModes") = 0 Rs("FontModes") = 0 Rs("ChannelName") = "动画频道" Rs("Caption") = "动画频道" Rs("ChannelDir") = "flash/" Rs("StopChannel") = 0 Rs("IsHidden") = 0 Rs("LinkTarget") = 0 Rs("ChannelType") = 0 Rs("ChannelUrl") = "http://" Rs("modules") = 5 Rs("BindDomain") = 0 Rs("DomainName") = "http://" Rs("ModuleName") = "动画" Rs("ChannelSkin") = 0 Rs("HtmlPath") = 0 Rs("HtmlForm") = 3 Rs("IsCreateHtml") = 0 Rs("HtmlExtName") = ".html" Rs("HtmlPrefix") = "flash_" Rs("StopUpload") = 1 Rs("MaxFileSize") = 500 Rs("UpFileType") = "rar|zip|exe|gif|jpg|png|bmp|swf" Rs("IsAuditing") = 1 Rs("AppearGrade") = 0 Rs("PostGrade") = 0 Rs("LeastString") = 10 Rs("MaxString") = 500 Rs("PaginalNum") = 15 Rs("LeastHotHist") = 50 Rs("Channel_Setting") = "|||@@@|||@@@|||" Rs.update Rs.Close:Set Rs = Nothing Application.Contents.RemoveAll SQL = "SELECT ChannelID,modules FROM NC_Channel WHERE ChannelType=1 ORDER BY ChannelID ASC" Set Rs = Conn.Execute(SQL) If Not (Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF Call AddTemplate(Rs("ChannelID"),Rs("modules"),newskinid) Rs.movenext Loop End If Set Rs = Nothing Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM NC_CustomLabel" Rs.Open SQL,tConn,1,3 If Not (Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF If Rs("LabelName") = "Header" Then SQL = "Insert Into NC_CustomLabel (ChannelID,LabelName,readme,content,estop,NotAllow) values" &_ "(0,'Header','模板顶部通用标签,请将此标签复制到模板内容开始的位置'," &_ "'" & CheckStr(Rs("content")) & "',0,1)" Conn.Execute(SQL) Else SQL = "Insert Into NC_CustomLabel (ChannelID,LabelName,readme,content,estop,NotAllow) values" &_ "(0,'Bottom','模板底部通用标签,请将此标签复制到模板内容结束的位置'," &_ "'" & CheckStr(Rs("content")) & "',0,1)" Conn.Execute(SQL) End If Rs.movenext Loop Response.Write TableTop & "添加自定标签成功
" & TableEnd Response.Flush End If Rs.Close:Set Rs = Nothing End Sub Sub AddTemplate(ChannelID,moduleid,newskinid) Dim rstmp,i Dim TemplateDir,TemplateFields,TemplateValues Set rstmp = tConn.Execute("SELECT * FROM NC_Template WHERE ChannelID=" & CLng(moduleid)) SQL=rstmp.GetRows(-1) Set rstmp = Nothing For i=0 To Ubound(SQL,2) TemplateDir = "" TemplateFields = "ChannelID,skinid,pageid,TemplateDir,page_name,page_content,page_setting,Template_Help,isDefault" TemplateValues = "" & ChannelID & ","& newskinid &"," & SQL(3,i) & ",'" & TemplateDir & "','" & CheckStr(SQL(5,i)) & "','" & CheckStr(SQL(6,i)) & "','" & CheckStr(SQL(7,i)) & "','" & CheckStr(SQL(8,i)) & "'," & SQL(9,i) & "" Conn.Execute ("INSERT INTO NC_Template (" & TemplateFields & ") VALUES (" & TemplateValues & ")") Next SQL=Null End Sub Sub CreateDataTable() On Error Resume Next If Checktable("NC_FlashList") Then DelTable("NC_FlashList") End If SQL = "CREATE TABLE [NC_FlashList] ([flashid] int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY," SQL = SQL &_ "[ChannelID] int NOT NULL default 0," &_ "[ClassID] int NOT NULL default 0," &_ "[SpecialID] int NOT NULL default 0," &_ "[title] nvarchar (250) NOT NULL ," &_ "[ColorMode] smallint NOT NULL default 0," &_ "[FontMode] smallint NOT NULL default 0," &_ "[Introduce] text NULL ," &_ "[Related] nvarchar (255) NULL ," &_ "[Describe] nvarchar (255) NULL ," &_ "[filesize] int NULL default 0," &_ "[Author] nvarchar (255) NULL ," &_ "[ComeFrom] nvarchar (255) NULL ," &_ "[star] smallint NOT NULL default 0," &_ "[miniature] nvarchar (255) NULL ," &_ "[UserGroup] int NOT NULL default 0," &_ "[PointNum] int NULL default 0," &_ "[UserName] nvarchar (50) NULL ," &_ "[addTime] smalldatetime default Now()," &_ "[HtmlFileDate] nvarchar (255) NULL ," &_ "[AllHits] int NOT NULL default 0," &_ "[DayHits] int NULL default 0," &_ "[WeekHits] int NULL default 0," &_ "[MonthHits] int NULL default 0," &_ "[HitsTime] smalldatetime default Now()," &_ "[grade] int NULL default 0," &_ "[showmode] smallint NULL default 0," &_ "[isTop] tinyint NOT NULL default 0," &_ "[IsBest] tinyint NOT NULL default 0," &_ "[ErrCode] int NULL default 0," &_ "[downmode] smallint NULL default 0," &_ "[downid] int NOT NULL default 0," &_ "[showurl] nvarchar (255) NULL ," &_ "[DownAddress] nvarchar (255) NULL ," &_ "[UploadFile] text NULL ," &_ "[isUpdate] smallint NULL default 0," &_ "[isAccept] tinyint NOT NULL default 0," &_ "[ForbidEssay] tinyint NULL default 0," &_ "[AlphaIndex] nvarchar (10) NULL " &_ ")" Conn.Execute(SQL) If Err.Number <> 0 Then Response.Write TableTop & "新建 " & TableName & " 表错误，原因" & Err.Description & "操作,跳过.
" & TableEnd Err.Clear() Response.Flush Else Response.Write TableTop & "新建 " & TableName & " 表成功。
" & TableEnd Response.Flush End If End Sub Sub addLabelContent() Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT customid,ChannelID,LabelName,readme,content,estop,NotAllow FROM NC_CustomLabel" Rs.Open SQL,Conn,1,1 If Not(Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF SQL = "Insert Into NC_CustomLabel (ChannelID,LabelName,readme,content,estop,NotAllow) values" &_ "(0,'" & Replace(Rs("LabelName"), "'", "") & "'," &_ "'" & Replace(Rs("readme"), "'", "") & "','" & Replace(Rs("content"), "'", "''") & "',0,1)" Conn.Execute(SQL) Rs.movenext Loop End If Rs.Close:Set Rs = Nothing End Sub Sub addSiteCountTable() On Error Resume Next SQL = "CREATE TABLE [NC_SiteCount] ([id] int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY," SQL = SQL &_ "[UniqueIP] int NOT NULL default 0," &_ "[Pageview] int NOT NULL default 0," &_ "[CountDate] smalldatetime default Now()," &_ "[google] int NOT NULL default 0," &_ "[baidu] int NOT NULL default 0," &_ "[yahoo] int NOT NULL default 0," &_ "[C3721] int NOT NULL default 0," &_ "[zhongsou] int NOT NULL default 0," &_ "[sogou] int NOT NULL default 0," &_ "[other] int NOT NULL default 0," &_ "[DirectInput] int NOT NULL default 0," &_ "[AlexaToolbar] int NOT NULL default 0" &_ ")" Conn.Execute(SQL) If Err.Number <> 0 Then Response.Write TableTop & "新建[NC_SiteCount]表错误，原因" & Err.Description & "操作,跳过.
" & TableEnd Err.Clear() Response.Flush Else Response.Write TableTop & "新建[NC_SiteCount]表成功。
" & TableEnd Response.Flush End If End Sub Sub addCardTable() On Error Resume Next Conn.Execute("Drop Table NC_Card") If Err.Number <> 0 Then Err.Clear() SQL = "CREATE TABLE [NC_Card] ([CardID] int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY," SQL = SQL &_ "[CardMark] nvarchar (50) NULL," &_ "[CardPass] nvarchar (50) NULL," &_ "[CardType] smallint NOT NULL default 0," &_ "[UseDayNum] int NOT NULL default 0," &_ "[CardMoney] money NOT NULL default 0," &_ "[addPoint] int NOT NULL default 0," &_ "[addExperience] int NOT NULL default 0," &_ "[addCharm] int NOT NULL default 0," &_ "[UserName] nvarchar (50) NULL," &_ "[UserGroup] smallint NOT NULL default 0," &_ "[IsConsume] tinyint NOT NULL default 0," &_ "[addTime] datetime default Now()" &_ ")" Conn.Execute(SQL) If Err.Number <> 0 Then Response.Write TableTop & "新建[NC_Card]表错误，原因" & Err.Description & "操作,跳过.
" & TableEnd Err.Clear() Response.Flush Else Response.Write TableTop & "新建[NC_Card]表成功。
" & TableEnd Response.Flush End If End Sub Sub addCustomLabelTable() On Error Resume Next SQL = "CREATE TABLE [NC_CustomLabel] ([customid] int IDENTITY (1, 1) NOT NULL CONSTRAINT PrimaryKey PRIMARY KEY," SQL = SQL &_ "[ChannelID] int NOT NULL default 0," &_ "[LabelName] nvarchar (255) NULL," &_ "[readme] nvarchar (255) NULL," &_ "[content] ntext NULL," &_ "[estop] smallint NOT NULL default 0," &_ "[NotAllow] smallint NOT NULL default 0" &_ ")" Conn.Execute(SQL) If Err.Number <> 0 Then Response.Write TableTop & "新建[NC_CustomLabel]表错误，原因" & Err.Description & "操作,跳过.
" & TableEnd Err.Clear() Response.Flush Else Response.Write TableTop & "新建[NC_CustomLabel]表成功。
" & TableEnd Response.Flush End If End Sub Function ChkNumeric(ByVal CHECK_ID) If CHECK_ID <> "" And IsNumeric(CHECK_ID) Then CHECK_ID = CLng(CHECK_ID) If CHECK_ID < 0 Then CHECK_ID = 0 Else CHECK_ID = 0 End If ChkNumeric = CHECK_ID End Function %>