<% @ Language=VBScript %> <% Option Explicit %> <% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Forums(TM) '** http://www.webwizforums.com '** '** Copyright (C)2001-2014 Web Wiz Ltd. All Rights Reserved. '** '** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS UNDER LICENSE FROM WEB WIZ LTD. '** '** IF YOU DO NOT AGREE TO THE LICENSE AGREEMENT THEN WEB WIZ LTD. IS UNWILLING TO LICENSE '** THE SOFTWARE TO YOU, AND YOU SHOULD DESTROY ALL COPIES YOU HOLD OF 'WEB WIZ' SOFTWARE '** AND DERIVATIVE WORKS IMMEDIATELY. '** '** If you have not received a copy of the license with this work then a copy of the latest '** license contract can be found at:- '** '** http://www.webwiz.co.uk/license '** '** For more information about this software and for licensing information please contact '** 'Web Wiz' at the address and website below:- '** '** Web Wiz Ltd, Unit B10, 9 Nimrod Way, East Dorset Trade Park, Ferndown, Dorset, BH21 7UH, England '** http://www.webwiz.co.uk '** '** Removal or modification of this copyright notice will violate the license contract. '** '**************************************************************************************** '*************************** SOFTWARE AND CODE MODIFICATIONS **************************** '** '** MODIFICATION OF THE FREE EDITIONS OF THIS SOFTWARE IS A VIOLATION OF THE LICENSE '** AGREEMENT AND IS STRICTLY PROHIBITED '** '** If you wish to modify any part of this software a license must be purchased '** '**************************************************************************************** Response.Buffer = True 'If the database is already setup then move 'em If strDatabaseType <> "" Then Response.Redirect("default.asp") Dim blnDetailedErrorReporting Dim blnErrorLogging Dim strLoggedInUsername Dim blnLoggingEnabled Dim strErrorMessage Dim strAccessDbPath Dim strAccessDbFileName Dim strAccessOrgFileLocation Dim blnAccessDbPhysicalPath blnDetailedErrorReporting = True blnErrorLogging = False blnLoggingEnabled = False strAccessOrgFileLocation = Server.MapPath("database\wwForum.mdb") 'Read in form contents strSQLServerName = Trim(Mid(Request.Form("DbServer"), 1, 80)) strSQLServerName = formatSQLInput(strSQLServerName) strSQLDBName = Trim(Mid(Request.Form("DbName"), 1, 50)) strSQLDBName = formatSQLInput(strSQLDBName) strSQLDBUserName = Trim(Mid(Request.Form("DbUsername"), 1, 50)) strSQLDBUserName = formatSQLInput(strSQLDBUserName) strSQLDBPassword = Trim(Mid(Request.Form("DbPassword"), 1, 50)) strSQLDBPassword = formatSQLInput(strSQLDBPassword) strAccessDbPath = Trim(Mid(Request.Form("AccessDbPath"), 1, 80)) strAccessDbFileName = Trim(Mid(Request.Form("AccessDbName"), 1, 20)) blnAccessDbPhysicalPath = CBool(Request.Form("AccessDbServerPath")) 'Check access DB path is OK strAccessDbPath = Replace(strAccessDbPath, "/", "\") If strAccessDbPath <> "" AND isNull(strAccessDbPath) = False Then If Mid(strAccessDbPath, len(strAccessDbPath), 1) <> "\" Then strAccessDbPath = strAccessDbPath & "\" End If 'Set the type of database '*** SQL Server **** If Request.Form("DbType") = "SQLServer" Then strDatabaseType = "SQLServer" blnSqlSvrAdvPaging = True '*** SQL Server 2000 **** ElseIf Request.Form("DbType") = "SQLServer2000" Then strDatabaseType = "SQLServer" blnSqlSvrAdvPaging = False '*** mySQL **** ElseIf Request.Form("DbType") = "mySQL" Then strDatabaseType = "mySQL" If Request.Form("myODBC") = "5.1" Then strMyODBCDriver = "5.1" Else strMyODBCDriver = "3.51" End If '*** Access **** ElseIf Request.Form("DbType") = "Access" Then 'DB Type strDatabaseType = "Access" 'Set error trapping On Error Resume Next 'Location of database If blnAccessDbPhysicalPath Then strDbPathAndName = strAccessDbPath & strAccessDbFileName Else strDbPathAndName = Server.MapPath(strAccessDbPath & strAccessDbFileName) End If 'If an error has occurred write an error to the page If Err.Number <> 0 Then strErrorMessage = ("

Error details:-
" & Err.Source & "
" & Err.Description & "

") 'Disable error trapping On Error goto 0 'Move database to new location (removed as due to support issues) 'dim fs 'set fs=Server.CreateObject("Scripting.FileSystemObject") 'fs.CopyFile strAccessOrgFileLocation, Server.MapPath(strAccessDbPath & "/" & strAccessDbFileName) 'set fs=nothing End If 'SQL Server Connection String If strDatabaseType = "SQLServer" Then 'MS SQL Server OLE Driver (If you change this string make sure you also change it in the msSQL_server_setup.asp file when creating the database) strCon = "Provider=SQLOLEDB;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";" 'MySQL Server Connection String ElseIf strDatabaseType = "mySQL" Then 'myODBC Driver strCon = "Driver={MySQL ODBC " & strMyODBCDriver & " Driver};Port=3306;Option=3;Server=" & strSQLServerName & ";User ID=" & strSQLDBUserName & ";Password=" & strSQLDBPassword & ";Database=" & strSQLDBName & ";" 'MS Access Connection String ElseIf strDatabaseType = "Access" Then 'Database driver (Microsoft JET OLE DB driver version 4) strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strDbPathAndName 'Database driver (Microsoft ACE OLE DB driver) for Access 2007 'strCon = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & strCon End If 'Open Datbase Connection '*********************** 'Create a db connection odject Set adoCon = CreateObject("ADODB.Connection") 'Set error trapping On Error Resume Next 'Set the connection string to the database adoCon.connectionstring = strCon 'Set an active connection to the Connection object adoCon.Open 'If an error has occurred write an error to the page If Err.Number <> 0 Then strErrorMessage = ("

Error details:-
" & Err.Source & "
" & Err.Description & "

") 'Disable error trapping On Error goto 0 'Clean up Set adoCon = Nothing %> Test Database Connection <% Response.Write(vbCrLf & vbCrLf & "" & vbCrLf) '***** END WARNING - REMOVAL OR MODIFICATION OF THIS CODE WILL VIOLATE THE LICENSE AGREEMENT ****** %>

Test Database Connection

Test Database Connection
<% 'If error occured If strErrorMessage <> "" Then Response.Write("
An Error Occurred Connecting to the Database") Response.Write(strErrorMessage) Else Response.Write("
The Database Connection was Successful
") End If %>