📄 setup.asp
字号:
UpdateErrorCode = UpdateErrorCheck()
on error goto 0
if UpdateErrorCode = 0 then
Response.Write("<tr><td bgColor=green align=""left"" width=""30%""><font face=""宋体, Arial, Helvetica"" size=""2""><b>Upgraded: </b></font></td><td bgColor=navyblue align=""left""><font face=""宋体, Arial, Helvetica"" size=""2""> Added default values for new fields in CONFIG table</font></td></tr>")
elseif UpdateErrorCode = 2 then
Response.Write("<tr><td bgColor=red align=""left"" width=""30%""><font face=""宋体, Arial, Helvetica"" size=""2""><b>Critical error: </b></font></td><td bgColor=navyblue align=""left""><font face=""宋体, Arial, Helvetica"" size=""2"">Can't add default values for new fields in CONFIG table!<b></font></td></tr>")
intCriticalErrors = intCriticalErrors + 1
else
Response.Write("<tr><td bgColor=red align=""left"" width=""30%""><font face=""宋体, Arial, Helvetica"" size=""2""><b>Critical error: code: </b></font></td><td bgColor=navyblue align=""left""><font face=""宋体, Arial, Helvetica"" size=""2"">" & UpdateErrorCode & " while trying to add default values to the CONFIG table</font></td></tr>")
intCriticalErrors = intCriticalErrors + 1
end if
Response.Write("</table>")
Response.Flush
end if
if OldVersion = 5 then
'## just update the version info...
strSql = "UPDATE " & strTablePrefix & "CONFIG "
strSql = strSql & " SET C_STRVERSION = '" & strNewVersion & "'"
strSql = strSql & " WHERE CONFIG_ID = " & 1
on error resume next
my_Conn.Errors.Clear
my_Conn.Execute (strSql)
Response.Write("<table border=""0"" cellspacing=""0"" cellpadding=""5"" width=""50%"" align=""center"">")
UpdateErrorCode = UpdateErrorCheck()
on error goto 0
if UpdateErrorCode = 0 then
Response.Write("<tr><td bgColor=green align=""left"" width=""30%""><font face=""宋体, Arial, Helvetica"" size=""2""><b>Upgraded: </b></font></td><td bgColor=navyblue align=""left""><font face=""宋体, Arial, Helvetica"" size=""2""> Added default values for new fields in CONFIG table</font></td></tr>")
elseif UpdateErrorCode = 2 then
Response.Write("<tr><td bgColor=red align=""left"" width=""30%""><font face=""宋体, Arial, Helvetica"" size=""2""><b>Critical error: </b></font></td><td bgColor=navyblue align=""left""><font face=""宋体, Arial, Helvetica"" size=""2"">Can't add default values for new fields in CONFIG table!<b></font></td></tr>")
intCriticalErrors = intCriticalErrors + 1
else
Response.Write("<tr><td bgColor=red align=""left"" width=""30%""><font face=""宋体, Arial, Helvetica"" size=""2""><b>Critical error: code: </b></font></td><td bgColor=navyblue align=""left""><font face=""宋体, Arial, Helvetica"" size=""2"">" & UpdateErrorCode & " while trying to add default values to the CONFIG table</font></td></tr>")
intCriticalErrors = intCriticalErrors + 1
end if
Response.Write("</table>")
Response.Flush
end if
my_Conn.Close
set my_Conn = nothing
if intCriticalErrors = 0 then
%>
<p><font face="宋体, Arial, Helvetica" size="4">The Upgrade has been completed without errors !</font></p>
<%
else
%>
<p><font face="宋体, Arial, Helvetica" size="4"><b>The Upgrade has NOT been completed without errors !</b></font></p>
<p><font face="宋体, Arial, Helvetica" size="2">There were <%=intCriticalErrors %> Critical Errors...</font></p>
<%
if intWarnings > 0 then
%>
<p><font face="宋体, Arial, Helvetica" size="2">There were <%=intWarnings %> noncritical errors...</font></p>
<%
end if
end if
if intCriticalErrors > 0 then
%>
<p><font face="宋体, Arial, Helvetica" size="2"><a href="setup.asp?RC=3">Click here to retry....</a></font></p>
<%
end if
%>
<p><font face="宋体, Arial, Helvetica" size="2"><a href="default.asp" target="_top">Click here to return to the forum....</a></font></p>
</center></div>
<%
Application(strCookieURL & "ConfigLoaded")= ""
else
Response.Redirect "setup_logon.asp"
end if
elseif ResponseCode = 5 then '## install a new database
if strDBType = "access" then '## install is not available for Access !
Response.Redirect "setup.asp"
else
%>
<div align=center><center>
<p><font face="宋体, Arial, Helvetica" size="4">Installation of forum-tables in the database.</font></p>
</center></div>
<form action="setup.asp?RC=6" method="post" id=Form1 name=Form1>
</form>
<table border="0" cellspacing="0" cellpadding="5" width="50%" height="50%" align="center">
<tr>
<td bgColor=navyblue align="left"><font face="宋体, Arial, Helvetica" size="2">
<p>
<% if strDBType = "sqlserver" then %>
<p>Select the SQL-server version you are using:</p>
<p><input type="radio" class="radio" name="SQL_Server" value="SQL6" >SQL-Server 6.5<br>
<input type="radio" class="radio" checked name="SQL_Server" value="SQL7">SQL-Server 7 </p>
<% end if %>
<p>To install the tables in the database you need to create the empty database on the server first.<br>
Then you have to provide a username and password of a user that has table creation/modification rights at the database you use.<br>
This might not be the same user as you use in your connectionstring !<br>
<br>
Name: <input type="text" name="DBUserName" size="20"><br>
Password: <input type="password" name="DBPassword" size="20"></p>
</font>
</td>
</tr>
<tr>
<td align="center"><input type="submit" value="Continue" id="Submit1" name="Submit1"></td>
</tr>
</form>
</table>
<%
end if
elseif ResponseCode = 6 then '## start installing the tables in the database
if strDBType = "access" Then '## install is not available for access !
Response.Redirect "setup.asp"
else
%>
<div align=center><center>
<p><font face="宋体, Arial, Helvetica" size="4">Please Wait until the installation has been completed !</font></p>
<%
on error resume next
strInstallString = strConnString
if strDBType <> "access" then
strInstallString = CreateConnectionString(strConnString, Request.Form("DBUserName"), Request.Form("DBPassword"))
end if
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strInstallString
for counter = 0 to my_conn.Errors.Count -1
ConnErrorNumber = my_conn.Errors(counter).Number
if ConnErrorNumber <> 0 then
my_conn.Errors.Clear
Response.Redirect "setup.asp?RC=1&EC=" & ConnErrorNumber & "&RET=" & Server.URLEncode("setup.asp?RC=5")
end if
next
on error goto 0
intCriticalErrors = 0
%>
<table border="0" cellspacing="0" cellpadding="5" width="50%" height="50%" align="center">
<tr>
<%
strSQL_Server = Request.Form("Sql_Server")
if strDBType = "mysql" then %>
<!--#INCLUDE FILE="inc_create_forum_mysql.asp" -->
<%
elseif strDBType = "sqlserver" then
if strSQL_Server = "SQL6" then %>
<!--#INCLUDE FILE="inc_create_forum_sql6.asp" -->
<% else
%>
<!--#INCLUDE FILE="inc_create_forum_sql7.asp" -->
<% end if
end if %>
</tr>
</table>
<%
my_Conn.Close
set my_Conn = nothing
if intCriticalErrors = 0 then
%>
<p><font face="宋体, Arial, Helvetica" size="4">The Installation has been completed !</font></p>
<%
else
%>
<p><font face="宋体, Arial, Helvetica" size="4"><b>The Installation has NOT been completed !</b></font></p>
<p><font face="宋体, Arial, Helvetica" size="2">There were <%=intCriticalErrors %> Critical Errors...</font></p>
<%
end if
if intCriticalErrors > 0 then
%>
<p><font face="宋体, Arial, Helvetica" size="2"><a href="setup.asp?RC=5">Click here to retry....</a></font></p>
<%
end if
%>
<p><font face="宋体, Arial, Helvetica" size="2"><a href="setup.asp" target="_top">Click here to check the Database....</a></font></p>
</center></div>
<%
end if
else
%>
<html>
<head>
<title>Undefined error !!</title>
<meta name="copyright" content="Snitz Forums 2000 Version 3.1 SR4 汉化修改:网虫中国资讯网">
<Style><!--
a:link {color:<% =strLinkColor %>;text-decoration:none;}
a:visited {color:<% =strVisitedLinkColor %>;text-decoration:none;}
a:hover {color:<% =strHoverFontColor %>;text-decoration:underline;}
--></style>
</head>
<body bgColor="white" text="midnightblue" link="darkblue" aLink=red vLink="red" onLoad="window.focus()">
<div align=center><center>
<font face="宋体, Arial, Helvetica" size="4">There has been an error !!</font>
</center></div>
<table border="0" cellspacing="0" cellpadding="5" width="100%" align="left">
<tr>
<td bgColor=navyblue align="center">
<font face="宋体, Arial, Helvetica" size="2">
<% Response.Write(Err.number & ", " & Err.description) %>
</font></td>
</tr>
<tr>
<td align="center">
<font face="宋体, Arial, Helvetica" size="2">
<a href="default.asp" target="_top">Click here to retry.</a>
</font></td>
</tr>
</table>
<%
End if
%>
</body>
</html>
<%
sub CheckSqlError()
dim ChkConnErrorNumber
for counter = 0 to my_Conn.Errors.Count -1
ChkConnErrorNumber = my_Conn.Errors(counter).Number
if ChkConnErrorNumber <> 0 or Err.number > 0 then
my_Conn.Errors.Clear
Err.Clear
strSql = "SELECT " & strTablePrefix & "CONFIG.C_STRVERSION, "
strSql = strSql & strTablePrefix & "CONFIG.C_STRSENDER "
strSql = strSql & " FROM " & strTablePrefix & "CONFIG "
set rsInfo = my_Conn.Execute (StrSql)
strVersion = rsInfo("C_STRVERSION")
strSender = rsInfo("C_STRSENDER")
rsInfo.Close
set rsInfo = nothing
my_Conn.Close
set my_Conn = nothing
Response.Redirect "setup.asp?RC=2&MAIL=" & Server.UrlEncode(strSender) & "&VER=" & Server.URLEncode(strVersion) & "&EC=" & ChkConnErrorNumber
end if
next
end sub
function UpdateErrorCheck()
dim intErrorNumber
dim counter
intErrorNumber = 0
for counter = 0 to my_Conn.Errors.Count -1
intErrorNumber = my_Conn.Errors(counter).Number
if intErrorNumber <> 0 then
select case intErrorNumber
case -2147217900
UpdateErrorCheck = 1
counter = my_Conn.Errors.Count -1
case -2147467259
UpdateErrorCheck = 2
counter = my_Conn.Errors.Count -1
case else
UpdateErrorCheck = intErrorNumber
end select
end if
next
end function
Sub AddColumns(Columns, intCriticalErrors, intWarnings)
Dim colCounter
Response.Writ
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -