Hi,
you can add your code in the generated include/dbcommon.asp file.
Thanks, Jane. I would really appreciate it if you could tell em where to put that bit of code.
Here is the contents of my dbcommon.asp file:
<%@codepage=1252%>
<%
cCharset = "Windows-1252"
response.Charset=cCharset
dDebug=false
useAJAX=true
suggestAllContent=true
Session.LCID = 1033
session.codepage=1252
dSQL=""
bSubqueriesSupported=true
strDatabaseType = "MS SQL SERVER"
Set tables_data = CreateObject("Scripting.Dictionary")
Set field_labels = CreateObject("Scripting.Dictionary")
Set arrAvailableEvents = CreateObject("Scripting.Dictionary")
dim dbConnection
%>
<!--#include file="locale.asp"-->
<!--#include file="events.asp"-->
<!--#include file="commonfunctions.asp"-->
<!--#include file="dbconnection.asp"-->
<!--#include file="dal_source.asp"-->
<!--#include file="aspfunctions.asp"-->
<%
dim conn
Const FORMAT_NONE = ""
Const FORMAT_DATE_SHORT = "Short Date"
Const FORMAT_DATE_LONG = "Long Date"
Const FORMAT_DATE_TIME = "Datetime"
Const FORMAT_TIME = "Time"
Const FORMAT_CURRENCY = "Currency"
Const FORMAT_PERCENT = "Percent"
Const FORMAT_HYPERLINK = "Hyperlink"
Const FORMAT_EMAILHYPERLINK = "Email Hyperlink"
Const FORMAT_FILE_IMAGE = "File-based Image"
Const FORMAT_DATABASE_IMAGE = "Database Image"
Const FORMAT_DATABASE_FILE = "Database File"
Const FORMAT_FILE = "Document Download"
Const FORMAT_LOOKUP_WIZARD = "Lookup wizard"
Const FORMAT_PHONE_NUMBER = "Phone Number"
Const FORMAT_NUMBER = "Number"
Const FORMAT_HTML = "HTML"
Const FORMAT_CHECKBOX = "Checkbox"
Const FORMAT_CUSTOM = "Custom"
Const EDIT_FORMAT_NONE = ""
Const EDIT_FORMAT_TEXT_FIELD = "Text field"
Const EDIT_FORMAT_TEXT_AREA = "Text area"
Const EDIT_FORMAT_PASSWORD = "Password"
Const EDIT_FORMAT_DATE = "Date"
Const EDIT_FORMAT_TIME = "Time"
Const EDIT_FORMAT_RADIO = "Radio button"
Const EDIT_FORMAT_CHECKBOX = "Checkbox"
Const EDIT_FORMAT_DATABASE_IMAGE = "Database image"
Const EDIT_FORMAT_DATABASE_FILE = "Database file"
Const EDIT_FORMAT_FILE = "Document upload"
Const EDIT_FORMAT_LOOKUP_WIZARD = "Lookup wizard"
Const EDIT_FORMAT_HIDDEN = "Hidden field"
Const EDIT_FORMAT_READONLY = "Readonly"
Const EDIT_DATE_SIMPLE = 0
Const EDIT_DATE_SIMPLE_DP = 11
Const EDIT_DATE_DD = 12
Const EDIT_DATE_DD_DP = 13
Const MODE_ADD = 0
Const MODE_EDIT = 1
Const MODE_SEARCH = 2
Const MODE_LIST = 3
Const MODE_PRINT = 4
Const MODE_VIEW = 5
Const MODE_INLINE_ADD = 6
Const MODE_INLINE_EDIT = 7
Const LOGIN_HARDCODED = 0
Const LOGIN_TABLE = 1
Const ADVSECURITY_ALL = 0
Const ADVSECURITY_VIEW_OWN = 1
Const ADVSECURITY_EDIT_OWN = 2
Const ADVSECURITY_NONE = 3
Const ACCESS_LEVEL_ADMIN = "Admin"
Const ACCESS_LEVEL_ADMINGROUP = "AdminGroup"
Const ACCESS_LEVEL_USER = "User"
Const ACCESS_LEVEL_GUEST = "Guest"
Const DATABASE_MySQL = "MYSQL"
Const DATABASE_Oracle = "ORACLE"
Const DATABASE_MSSQLServer = "MS SQL SERVER"
Const DATABASE_Access = "ACCESS"
Const RTE_BASIC = "BASIC"
Const RTE_FCK = "FCK"
Const RTE_INNOVA = "INNOVA"
Const ADD_SIMPLE = 0
Const ADD_INLINE = 1
Const ADD_ONTHEFLY = 2
Const LIST_SIMPLE = 0
Const LIST_LOOKUP = 1
Const LCT_DROPDOWN = 0
Const LCT_AJAX = 1
Const LCT_LIST = 2
Const LCT_CBLIST = 3
Const LT_LISTOFVALUES = 0
Const LT_LOOKUPTABLE = 1
strLeftWrapper="["
strRightWrapper="]"
cLoginTable = "C270584_admin.Users"
cUserNameField = "UserName"
cPasswordField = "Password"
cUserGroupField = "UserName"
cEmailField = "x_Email"
cFrom = "me@gmail.com"
cSmtpServer = "mail.mysite.com"
cSmtpPort = "localhost"
cSMTPUser = "name@mysite.com"
cSMTPPassword = "password"
gPermissionsRefreshTime=0
gPermissionsRead=false
set includes_js=server.CreateObject("Scripting.Dictionary")
set includes_jsreq=server.CreateObject("Scripting.Dictionary")
set includes_css=server.CreateObject("Scripting.Dictionary")
Set myRequest = CreateObject("Scripting.Dictionary")
Set myRequestFiles = CreateObject("Scripting.Dictionary")
parse=0
set conn=db_connect()
set dbConnection=conn
' determine current page
if SESSION("UserID")="" then
allowGuest=guestHasPermissions()
dim path,pos,file
path=request.ServerVariables("PATH_INFO")
pos=instrrev(path,"/")
file=lcase(mid(path,pos+1))
if allowGuest and file<>"login.asp" and file<>"remind.asp" and file<>"register.asp" then
SESSION("UserID")="Guest"
SESSION("GroupID")="<Guest>"
SESSION("AccessLevel")=ACCESS_LEVEL_GUEST
if asp_functionexists("AfterSuccessfulLogin") then
AfterSuccessfulLogin "","",CreateDictionary()
end if
end if
function db_connect()
set dbConnection = server.CreateObject("ADODB.Connection")
dbConnection.ConnectionString = strConnection
dbConnection.Open
set db_connect=dbConnection
end function
function AddTableWrappers(strName)
if mid(strName,1,1)=strLeftWrapper then
AddTableWrappers = strName
exit function
end if
dim arr
arr=split(strName,".")
ret=strLeftWrapper & arr(0) & strRightWrapper
if ubound(arr)>0 then ret=ret & "." & strLeftWrapper & arr(1) & strRightWrapper
AddTableWrappers = ret
end function
function db_upper(dbval)
db_upper = "upper(" & dbval & ")"
end function
function AddFieldWrappers(strName)
if mid(strName,1,1)=strLeftWrapper then
AddFieldWrappers = strName
else
AddFieldWrappers = strLeftWrapper & strName & strRightWrapper
end if
end function
function FieldNeedQuotes(rs,field)
ttype=dbfieldtype(rs,field)
if ttype=20 or ttype=128 or ttype=11 or ttype=6 or ttype=14 or ttype=5 or ttype=3 or ttype=131
or ttype=4 or ttype=2 or ttype=16 or ttype=21 or ttype=19 or ttype=18 or ttype=17 or ttype=139 then
FieldNeedQuotes = false
else
FieldNeedQuotes = true
end if
end function
function db_addslashes(str)
db_addslashes = asp_str_replace("'","''",str)
end function
function db_datequotes(val)
db_datequotes = "convert(datetime,'" & val & "',120)"
end function
function db_stripslashesbinary(str)
db_stripslashesbinary=str
end function
function db_fieldtype(lhandle,fname)
Dim i
for i=0 to db_numfields(lhandle)-1
if db_fieldname(lhandle,i)=fname then
ttype=db_fieldtypen(lhandle,i)
db_fieldtype = ttype
exit function
end if
next
db_fieldtype = ""
end function
function db_numfields(lhandle)
db_numfields = lhandle.Fields.Count
end function
function db_fieldname(lhandle,fnumber)
db_fieldname = lhandle.Fields(fnumber).Name
end function
function db_fieldtypen(lhandle,fnumber)
dbfieldtypen = lhandle.Fields(fnumber).Type
end function
function date2str(val)
if isnull(val) then
date2str=""
exit function
end if
if isdate(val) then
date2str = CStr(year(val)) & "-" & CStr(month(val)) & "-" & CStr(day(val)) &
" " & CStr(hour(val)) & ":" & CStr(minute(val)) & ":" & CStr(second(val))
exit function
end if
date2str=""
end function
%>