updatedb.asp
上传用户:saigedz
上传日期:2019-10-14
资源大小:997k
文件大小:5k
- <%@ CODEPAGE=65001 %>
- <%
- '///////////////////////////////////////////////////////////////////////////////
- '// 插件应用: Z-Blog 1.7
- '// 插件制作:
- '// 备 注:
- '// 最后修改:
- '// 最后版本:
- '///////////////////////////////////////////////////////////////////////////////
- %>
- <% Option Explicit %>
- <% On Error Resume Next %>
- <% Response.Charset="UTF-8" %>
- <% Response.Buffer=True %>
- <!-- #include file="../../c_option.asp" -->
- <!-- #include file="../../function/c_function.asp" -->
- <!-- #include file="../../function/c_function_md5.asp" -->
- <!-- #include file="../../function/c_system_lib.asp" -->
- <!-- #include file="../../function/c_system_base.asp" -->
- <!-- #include file="../../function/c_system_event.asp" -->
- <!-- #include file="../../function/c_system_plugin.asp" -->
- <%
- Call System_Initialize()
- '检查非法链接
- Call CheckReference("")
- '检查权限
- If BlogUser.Level>1 Then Call ShowError(6)
- If CheckPluginState("BackupDB")=False Then Call ShowError(48)
- BlogTitle="BackupDB(Z-Blog的数据库备份及升级程序)"
- If Request.QueryString("act")="UpdateDB" Then
-
- Call UpdateDateBase()
- Call SetBlogHint_Custom("‼ 提示:当前数据库结构已成功升级.")
- End If
- Function UpdateDateBase()
-
- If Not CheckUpdateDB("[log_IsTop]","[blog_Article]") Then
- objConn.execute("ALTER TABLE [blog_Article] ADD COLUMN [log_IsTop] YESNO DEFAULT FALSE")
- objConn.execute("UPDATE [blog_Article] SET [log_IsTop]=FALSE")
- End If
- If Not CheckUpdateDB("[log_Tag]","[blog_Article]") Then
- objConn.execute("ALTER TABLE [blog_Article] ADD COLUMN [log_Tag] VARCHAR(255)")
- End If
- If Not CheckUpdateDB("[tag_ID]","[blog_Tag]") Then
- objConn.execute("CREATE TABLE [blog_Tag] (tag_ID AutoIncrement primary key,tag_Name VARCHAR(255),tag_Intro text,tag_ParentID int,tag_URL VARCHAR(255),tag_Order int,tag_Count int)")
- End If
- If Not CheckUpdateDB("[coun_ID]","[blog_Counter]") Then
- objConn.execute("CREATE TABLE [blog_Counter] (coun_ID AutoIncrement primary key,coun_IP VARCHAR(20),coun_Agent text,coun_Refer VARCHAR(255),coun_PostTime TIME DEFAULT Now())")
- End If
- If Not CheckUpdateDB("[key_ID]","[blog_Keyword]") Then
- objConn.execute("CREATE TABLE [blog_Keyword] (key_ID AutoIncrement primary key,key_Name VARCHAR(255),key_Intro text,key_URL VARCHAR(255))")
- End If
- If Not CheckUpdateDB("[ul_Quote]","[blog_UpLoad]") Then
- objConn.execute("ALTER TABLE [blog_UpLoad] ADD COLUMN [ul_Quote] VARCHAR(255)")
- objConn.execute("UPDATE [blog_UpLoad] SET [ul_Quote]=''")
- objConn.execute("ALTER TABLE [blog_UpLoad] ADD COLUMN [ul_DownNum] int DEFAULT 0")
- End If
- End Function
- '*********************************************************
- ' 目的:
- '*********************************************************
- Function CheckUpdateDB(a,b)
- Err.Clear
- On Error Resume Next
- Dim Rs
- Set Rs=objConn.execute("SELECT "&a&" FROM "&b)
- Set Rs=Nothing
- If Err.Number=0 Then
- CheckUpdateDB=True
- Else
- Err.Clear
- CheckUpdateDB=False
- End If
- End Function
- '*********************************************************
- %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%=ZC_BLOG_LANGUAGE%>" lang="<%=ZC_BLOG_LANGUAGE%>">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta http-equiv="Content-Language" content="<%=ZC_BLOG_LANGUAGE%>" />
- <link rel="stylesheet" rev="stylesheet" href="../../CSS/admin.css" type="text/css" media="screen" />
- <script language="JavaScript" src="../../script/common.js" type="text/javascript"></script>
- <title><%=BlogTitle%></title>
- </head>
- <body>
- <div id="divMain">
- <div class="Header"><%=BlogTitle%></div>
- <div class="SubMenu">
- <span class="m-left"><a href="backupdb.asp">数据库备份</a></span>
- <span class="m-left m-now"><a href="updatedb.asp">数据库结构升级</a></span>
- </div>
- <div id="divMain2">
- <% Call GetBlogHint() %>
- <form id="edit" name="edit" method="post" action="?">
- <%
- Response.Write "<p><b>数据库结构升级</b>:将数据库程序升级至最新的数据库结构。有效的避免各种操作及功能不正常的问题。</p>"
- Response.Write "<p><input class=""button"" style=""width:100px"" type=""submit"" value=""提交"" id=""btnPost"" onclick=""this.form.action+='act=UpdateDB';return window.confirm('"& ZC_MSG058 &"');""/></p>" & vbCrlf
- Response.Write "<p></p>"
- %>
- </form>
- </div>
- <script language="javascript">
- function ChangeValue(obj){
- if (obj.value=="True")
- {
- obj.value="False";
- return true;
- }
- if (obj.value=="False")
- {
- obj.value="True";
- return true;
- }
- }
- </script>
- </body>
- </html>
- <%
- Call System_Terminate()
- If Err.Number<>0 then
- Call ShowError(0)
- End If
- %>