📄 install.asp
字号:
<!--#include file="../conn.asp"-->
<!--#include file="include/config.asp"-->
<!--#include file="include/define.asp"-->
<%
Private MyDB, clsEnv
Private intStep, intState, strReason
Call main
Public Sub main()
Set MyDB = MyKernel.DB
Set clsEnv = Server.CreateObject(PROGID_HASH)
HashAdd clsEnv, MyKernel.Resource("moex.twinbbs.env"), "|"
If Not TBBS_INSTALLED Then
intStep = atoi(Request.Form("Step"))
If intStep < 1 Then intStep = 1
Else
intStep = 100
End If
Select Case MyIO.Env("REQUEST_METHOD")
Case "GET"
Call doGet
Case "POST"
Call doPost
End Select
Set clsEnv = Nothing
Set MyDB = Nothing
End Sub
%>
<!--#include file="../free.asp"-->
<%
Private Sub doGet()
MyIO.Echo "<html>"
MyIO.Echo "<head>"
MyIO.Echo "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />"
MyIO.Echo "<meta http-equiv=""Cache-Control"" content=""no-cache, max-age=0"" />"
MyIO.Echo "<title>WAPmoBBS Installer 1.0</title>"
MyIO.Echo "<style>"
MyIO.Echo "table {border-collapse: collapse;empty-cells: show;}"
MyIO.Echo "#title {font-size: 14px; font-weight: bold; font-family: Helvetica, Arial, sans-serif; background-color:#004080; color: #FFFFFF; height: 24px; line-height: 24px;}"
MyIO.Echo "#title label {font-size: 12px; font-weight: normal;}"
MyIO.Echo "#name {width: 40%; font-size:12px; font-weight: bold;}"
MyIO.Echo "#value {width: 60%; font-size:12px;}"
MyIO.Echo "#hint {font-size: 12px; background-color: #FFFFA4;}"
MyIO.Echo ".f12 {font-size:12px}"
MyIO.Echo "</style>"
MyIO.Echo "</head>"
MyIO.Echo "<body>"
MyIO.Echo "<form action=""install.asp"" method=""post"">"
MyIO.Echo "<table width=""100%"" border=""1"" cellpadding=""2"" cellspacing=""0"" bordercolor=""#000000"">"
Select Case intStep
Case 1
If intState = 1 Then
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" id=""hint"">" & strReason & "</td>"
MyIO.Echo "</tr>"
End If
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" id=""hint"">注意:如果在已存在的WAPmoBBS论坛上重复安装,程序会删除所有旧的记录,如有需要,请先备份数据库</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" id=""title"">WAPmoBBS安装系统 - <label>超级管理员</label></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""name"">超级管理员帐号</td>"
MyIO.Echo "<td id=""value""><input type=""text"" name=""name"" style=""width:180px"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""name"">超级管理员密码</td>"
MyIO.Echo "<td id=""value""><input type=""password"" name=""passwd"" style=""width:180px"" /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""name"">超级管理员密码</td>"
MyIO.Echo "<td id=""value""><input type=""password"" name=""passwd"" style=""width:180px"" /> 再输入一次以便确认</td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" align=""center""><button type=""submit"">下一步</button></td>"
MyIO.Echo "</tr>"
Case 2
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" id=""title"">WAPmoBBS安装系统 - <label>论坛设置</label><input type=""hidden"" name=""step"" value=""2"" /></td>"
MyIO.Echo "</tr>"
If intState = 1 Then
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" id=""hint"">" & strReason & "</td>"
MyIO.Echo "</tr>"
End If
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""name"">论坛名称</td>"
MyIO.Echo "<td id=""value""><input type=""text"" name=""bbs_name"" style=""width:50%"" value=""" & clsEnv("bbs_name") & """ /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""name"">主站名称</td>"
MyIO.Echo "<td id=""value""><input type=""text"" name=""site_name"" style=""width:50%"" value=""" & clsEnv("site_name") & """ /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""name"">主站地址</td>"
MyIO.Echo "<td id=""value""><input type=""text"" name=""site_addr"" style=""width:50%"" value=""" & clsEnv("site_addr") & """ /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td id=""name"">首页名称</td>"
MyIO.Echo "<td id=""value""><input type=""text"" name=""index_name"" style=""width:50%"" value=""" & clsEnv("index_name") & """ /></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" align=""center"">"
MyIO.Echo "<button type=""button"" onclick=""history.go(-1)"">上一步</button>"
MyIO.Echo "<button type=""submit"">下一步</button>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
Case 100
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" id=""title"">WAPmoBBS安装系统 - <label>安装完成</label></td>"
MyIO.Echo "</tr>"
MyIO.Echo "<tr>"
MyIO.Echo "<td colspan=""2"" class=""f12"">"
MyIO.Echo "安装已完成,如需重新安装,修改include/config.asp文件中的"
MyIO.Echo "<blockquote>Public Const TBBS_INSTALLED = True</blockquote>"
MyIO.Echo "为"
MyIO.Echo "<blockquote>Public Const TBBS_INSTALLED = False</blockquote>"
MyIO.Echo "<a href=""index.asp"">点击进入论坛</a>"
MyIO.Echo "</td>"
MyIO.Echo "</tr>"
End Select
MyIO.Echo "</table>"
MyIO.Echo "</form>"
MyIO.Echo "</body>"
MyIO.Echo "</html>"
End Sub
Private Sub doPost()
intState = 1
If Not TBBS_INSTALLED Then
Call install_tbbs
End If
Call doGet
End Sub
Private Sub install_tbbs()
Select Case intStep
Case 1
Call install_data
Case 2
Call install_bbs
End Select
End Sub
Private Sub install_data()
Dim strName, strPasswd
Dim clsCmd
strName = Request.Form("name")
strPasswd = Split(Request.Form("passwd"), ", ")
If strName = "" Then
strReason = "请填写超级管理员帐号"
ElseIf UBound(strPasswd) <> 1 Then
strReason = "请填写超级管理员密码"
ElseIf strPasswd(0) = "" Then
strReason = "请填写超级管理员密码"
ElseIf strPasswd(0) <> strPasswd(1) Then
strReason = "请确认超级管理员密码"
Else
Set clsCmd = MyKernel.Command(T_USER)
clsCmd.CommandType = "SELECT"
clsCmd.Where = "USERNAME='" & SafeString(strName) & "'"
If clsCmd.Exec Then
clsCmd.CommandType = "UPDATE"
clsCmd.Where = "SEQID=" & clsCmd("seqid")
clsCmd.Add "UserName", strName
clsCmd.Add "Passwd", MD5(strPasswd(0))
clsCmd.Add "Face", 1
clsCmd.Add "Sex", -1
clsCmd.Add "ReplyHint", 0
clsCmd.Add "coin", 0
clsCmd.Add "cent", 0
clsCmd.Add "witchery", 0
clsCmd.Add "topics", 0
clsCmd.Add "replies", 0
clsCmd.Add "souls", 0
clsCmd.Add "deletes", 0
clsCmd.Add "favs", 0
clsCmd.Add "images", 0
clsCmd.Add "rings", 0
clsCmd.Add "videos", 0
clsCmd.Add "softs", 0
clsCmd.Add "uploads", 0
clsCmd.Add "State", TBBS_STATE_OK
clsCmd.Add "LoginCount", 0
clsCmd.Add "Online", 0
clsCmd.Add "RegTime", GetTime(Now())
clsCmd.Add "RegIP", MyIO.Env("REMOTE_ADDR")
clsCmd.Add "groupid", 1
clsCmd.Add "groupname", "管理员"
clsCmd.Add "groupimg", "20.gif"
clsCmd.Add "status", 9999
Else
clsCmd.CommandType = "INSERT"
clsCmd.Add "UserName", strName
clsCmd.Add "Passwd", MD5(strPasswd(0))
clsCmd.Add "Face", 1
clsCmd.Add "Sex", -1
clsCmd.Add "ReplyHint", 0
clsCmd.Add "coin", 0
clsCmd.Add "cent", 0
clsCmd.Add "witchery", 0
clsCmd.Add "topics", 0
clsCmd.Add "replies", 0
clsCmd.Add "souls", 0
clsCmd.Add "deletes", 0
clsCmd.Add "favs", 0
clsCmd.Add "images", 0
clsCmd.Add "rings", 0
clsCmd.Add "videos", 0
clsCmd.Add "softs", 0
clsCmd.Add "uploads", 0
clsCmd.Add "State", TBBS_STATE_OK
clsCmd.Add "LoginCount", 0
clsCmd.Add "Online", 0
clsCmd.Add "RegTime", GetTime(Now())
clsCmd.Add "RegIP", MyIO.Env("REMOTE_ADDR")
clsCmd.Add "groupid", 1
clsCmd.Add "groupname", "管理员"
clsCmd.Add "groupimg", "20.gif"
clsCmd.Add "status", 9999
End If
clsCmd.Exec
Set clsCmd = Nothing
intStep = 2
strReason = strReason & "数据库安装成功"
End If
End Sub
Private Sub install_bbs()
Dim objFile, strHome
clsEnv("bbs_name") = Request.Form("bbs_name")
clsEnv("site_name") = Request.Form("site_name")
clsEnv("site_addr") = Request.Form("site_addr")
clsEnv("index_name") = Request.Form("index_name")
MyKernel.Resource("moex.twinbbs.env") = HashString(clsEnv, "|")
strHome = reg_match("^(.+?)install\.asp$", "i", MyIO.Env("SCRIPT_NAME"))(0)
Set objFile = Server.CreateObject("ADODB.Stream")
objFile.Type = adTypeText
objFile.Charset = LOCAL_CHARSET
objFile.Open
objFile.WriteText "<" & "%", adWriteLine
objFile.WriteText "Public Const TBBS_INSTALLED = True", adWriteLine
objFile.WriteText "Public Const TBBS_HOME = """ & strHome & """", adWriteLine
objFile.WriteText "%" & ">", adWriteLine
objFile.SaveToFile Server.MapPath("include/config.asp"), adSaveCreateOverWrite
objFile.Close
Set objFile = Nothing
intStep = 100
End Sub
Private Sub MyDebug(arr)
Response.Write "<li>" & Join(arr, " - ") & "</li>"
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -