📄 conn.asp
字号:
<%@ LANGUAGE = VBScript CodePage = 936%>
<%
Option Explicit
Response.Buffer = True
Dim webPath
%>
<!--#include file="config.asp"-->
<%
Dim powerid
Dim DataPath,domain
Dim Comeurl
dim conn
Dim SqlNowString
Dim nowtit,action
domain=Request.ServerVariables("server_name")
'可修改设置一:========================定义数据库类别,1为SQL数据库,0为Access数据库================================
Const IsSqlDataBase = 0
'================================================================================================================
If IsSqlDataBase = 1 Then
'必修改设置二:========================SQL数据库设置=============================================================
'sql数据库连接参数:数据库名(SqlDatabaseName)、用户密码(SqlPassword)、用户名(SqlUsername)、
'连接名(SqlLocalName)(本地用local,外地用IP)
Const SqlDatabaseName = "cj_2007"
Const SqlPassword = ""
Const SqlUsername = "sa"
Const SqlLocalName = "(local)"
'===============================================================================================================
SqlNowString = "GetDate()"
Else
'必修改设置三:========================Access数据库设置==========================================================
'用户第一次使用请修改本处数据库地址并相应修改data目录中数据库名称
DataPath="data/#123zh.mdb" '相对根目录下绝对路径
'================================================================================================================
SqlNowString = "Now()"
End If
ConnectionDatabase
Dim rs,id,sql
Dim totalput,pagedw,CurrentPage,page,PurviewChecked
Dim strFileName,sql_tables,Sql_Conditions,Sql_Condition,Sql_Lists,Sql_Sortings,Sql_Orders,Sql_Additional
Dim rs_web,rs_edit,dels,user_check
Dim fun_cel,nos_i,fun_get
Dim types,keyword
Dim formaction
Dim i
Dim webtit,sitename
Sub ConnectionDatabase
Dim ConnStr
If IsSqlDataBase = 1 Then
ConnStr = "Provider = Sqloledb; User ID = " & SqlUsername & "; Password = " & SqlPassword & "; Initial Catalog = " & SqlDatabaseName & "; Data Source = " & SqlLocalName & ";"
Else
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(webPath & DataPath)
End If
On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Autopath
Response.End
End If
End Sub
Sub Autopath()
Dim ScriptAddress,inpath,contentstr,filepath,filepath2
Dim obj_fso,obj_fso2
Dim obj_file,obj_file2
ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) '虚拟目录+文件
inpath=Split(ScriptAddress,"/")
ScriptAddress=Replace(ScriptAddress,inpath(UBound(inpath)),"")
'文件内容开始
contentstr="%" & vbCrLf
contentstr=contentstr & "webPath=""" & ScriptAddress & """" & vbCrLf
contentstr=contentstr & "%"
'文件内容结束
filepath=server.mappath("config.asp")
set obj_fso=server.createobject("scripting.filesystemobject")
if obj_fso.fileexists(filepath) then
set obj_file=obj_fso.opentextfile(filepath,2,false)
obj_file.write contentstr
obj_file.close
set obj_file=Nothing
Else
filepath2=server.mappath("../config.asp")
set obj_fso2=server.createobject("scripting.filesystemobject")
if obj_fso2.fileexists(filepath2) then
set obj_file2=obj_fso2.opentextfile(filepath2,2,false)
obj_file2.write " <" & Replace(contentstr,ScriptAddress,Replace(ScriptAddress,"admin/","")) & "> "
obj_file2.close
set obj_file2=Nothing
'Response.Redirect "../index.asp"
response.write "<SCRIPT LANGUAGE=""JavaScript"">window.location.reload();</SCRIPT>"
else
response.write "数据库路径错误,请自行修改根目录下conn.asp文件!"
End If
end If
End Sub
Dim HTMLother
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -