<%
If InStr(LCase(Request.QueryString), "cast(") > 0 OR InStr(LCase(Request.QueryString), "exec(") > 0 Then
'Dim strEmailBody1
' strEmailBody1 = strEmailBody1 + "Possible Issue With QueryString: " & Request.ServerVariables("SERVER_NAME") & vbCrLf
' strEmailBody1 = strEmailBody1 + "FROM IP: " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf
' strEmailBody1 = strEmailBody1 + "From Page: " & Request.ServerVariables("SCRIPT_NAME") & vbCrLf
' strEmailBody1 = strEmailBody1 + "At: " & Now() & vbCrLf
'Dim obj1
' Set obj1 = Server.CreateObject("CDO.Message")
' obj1.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
' obj1.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
' obj1.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ") = 0
'Server port (typically 25)
' obj1.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
' obj1.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl ") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
' obj1.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' obj1.Configuration.Fields.Update
' With obj1
' .From = "sysmon@noc.lpmedia.net"
' .To = "nocalerts@lpmedia.net;nocalerts@light-power.com;lpsysmon@att.blackberry.net"
' .Subject = "Possible Issue With : " & Request.ServerVariables("SERVER_NAME")
' .TextBody = strEmailBody1
' .Send
' End With
Response.End
End If
If Request.ServerVariables("REQUEST_METHOD") = "Post" Then
'Dim strEmailBody2
'Dim item
for each item in request.form
If InStr(LCase(request.form(item)), "cast(") > 0 OR InStr(LCase(request.form(item)), "exec(") > 0 Then
' strEmailBody2 = strEmailBody2 + "Possible Issue With Form Fields: " & Request.ServerVariables("SERVER_NAME") & vbCrLf
' strEmailBody2 = strEmailBody2 + "FROM IP: " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf
' strEmailBody2 = strEmailBody2 + "From Page: " & Request.ServerVariables("SCRIPT_NAME") & vbCrLf
' strEmailBody2 = strEmailBody2 + "At: " & Now() & vbCrLf
'Dim obj2
' Set obj2 = Server.CreateObject("CDO.Message")
' obj2.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
' obj2.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
' obj2.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ") = 0
'Server port (typically 25)
' obj2.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
' obj2.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl ") = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
' obj2.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' obj2.Configuration.Fields.Update
' With obj2
' .From = "sysmon@noc.lpmedia.net"
' .To = "nocalerts@lpmedia.net;nocalerts@light-power.com;lpsysmon@att.blackberry.net"
' .Subject = "Possible Issue With : " & Request.ServerVariables("SERVER_NAME")
' .TextBody = strEmailBody2
' .Send
' End With
Response.End
End If
next
End If
Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
Dim dTemp
dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
GetWeekdayMonthStartsOn = WeekDay(dTemp)
End Function
Function GetDaysInMonth(iMonth, iYear)
Dim dTemp
dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
GetDaysInMonth = Day(dTemp)
End Function
Function GetDayofWeek(strDate, iWkday)
Dim dTemp, iWkDayTemp, iLoopCtr, iWkDayCtr, i
iWkDayTemp = iWkDay
iWkDayCtr = GetWeekdayMonthStartsOn(strDate)
iLoopCtr = 1
for i = 1 to 7
If CInt(iWkDayTemp) = CInt(iWkDayCtr) Then
GetDayofWeek = iLoopCtr
Exit Function
End If
If iWkDayCtr = 7 Then
iWkDayCtr = 1
Else
iWkDayCtr = iWkDayCtr + 1
End If
iLoopCtr = iLoopCtr + 1
Next
GetDayofWeek = iWkDayCtr
End Function
Function getMatrixInfo()
'On Error Resume Next
Dim oADO, oRecordset, oRecordset1, oRecordset2, oRecordset3, strSQL, strSQL1, strSQL2, strSQL3, bool_ADO, bool_REC, bool_REC1, bool_REC2, bool_REC3
Dim arrayMatrix, arrayBranchAbbrev, arrayActivity, arrayProgram
bool_ADO = getADO(oAdo) ' get connection object
bool_REC = getRecordset(oRecordset) ' get connection objec
bool_REC1 = getRecordset(oRecordset1)
bool_REC2 = getRecordset(oRecordset2)
bool_REC3 = getRecordset(oRecordset3)
getMatrixInfo = false
if ( (bool_ADO = true) and (bool_REC = true) and (bool_REC1 = true) and (bool_REC2 = true) and (bool_REC3 = true) ) then ' test to see if we can use the connection objects
strSQL = SQL_MATRIX
strSQL1 = SQL_MATRIX_ACTIVITIES
strSQL2 = SQL_BRANCH_ABBREV
strSQL3 = SQL_MATRIX_PROGRAM
oADO.Open db_strConn ' open connection to db
oRecordset.Open strSQL, oADO ' open recordset using SQL statement
oRecordset1.Open strSQL1, oADO ' open recordset using SQL statement
oRecordset2.Open strSQL2, oADO
oRecordset3.Open strSQL3, oADO
' If the recordset has at least one row, no problem
If Not oRecordset.EOF Then
arrayMatrix = oRecordset.GetRows
Session("matrix") = arrayMatrix
' Otherwise the array is the empty set
Else
Session("matrix") = Null
End If
If Not oRecordset1.EOF Then
arrayActivity = oRecordset1.GetRows
Session("activity") = arrayActivity
' Otherwise the array is the empty set
Else
Session("activity") = Null
End If
If Not oRecordset2.EOF Then
arrayBranchAbbrev = oRecordset2.GetRows
Session("abbrev") = arrayBranchAbbrev
' Otherwise the array is the empty set
Else
Session("abbrev") = Null
End If
If Not oRecordset3.EOF Then
arrayProgram = oRecordset3.GetRows
Session("program") = arrayProgram
'Otherwise the array is the empty set
Else
Session("program") = Null
End If
end if
If Err Then
getMatrixInfo = False
SetError "getMatrixInfo", Err.number, Err.description
Session(cChangeInfoError) = "getMatrix" & Err.number & " " & Err.Description & " "
Exit Function
End If
' If we get here, we're true
getMatrixInfo = True
End Function
Function getBranchActivities()
'On Error Resume Next
Dim oADO, oRecordset, oRecordset1, oRecordset2, oRecordset3, strSQL, strSQL1, strSQL2, strSQL3, bool_ADO, bool_REC, bool_REC1, bool_REC2, bool_REC3
Dim arrayBranchActivities, arrayBranch, arrayActivity, iBranch, arrayNotSelected
bool_ADO = getADO(oAdo) ' get connection object
bool_REC = getRecordset(oRecordset) ' get connection objec
bool_REC1 = getRecordset(oRecordset1)
bool_REC2 = getRecordset(oRecordset2)
bool_REC3 = getRecordset(oRecordset3)
getBranchActivities = false
if ( (bool_ADO = true) and (bool_REC = true) and (bool_REC1 = true) and (bool_REC2 = true) ) then ' test to see if we can use the connection objects
iBranch = Request.QueryString("Id")
strSQL = sqlBranch
oADO.Open db_strConn ' open connection to db
if not isEmpty(iBranch) and iBranch <> 0 then
strSQL1 = sqlMatrixActivities & iBranch & sqlMatrixActivities1
strSQL2 = sqlBranchActivities & iBranch & sqlBranchActivities1
oRecordset1.Open strSQL1, oADO
oRecordset2.Open strSQL2, oADO
If Not oRecordset2.EOF Then
arrayBranchActivities = oRecordset2.GetRows
Session("branchActivities") = arrayBranchActivities
arrayNotSelected = oRecordset1.GetRows
Session("notselected") = arrayNotSelected
'Otherwise the array is the empty set
Else
arrayActivity = oRecordset1.GetRows
Session("activity") = arrayActivity
Session("branchActivities") = Null
End If
else
strSQL1 = sqlActivity
oRecordset1.Open strSQL1, oADO
arrayActivity = oRecordset1.GetRows
Session("activity") = arrayActivity
Session("branchActivities") = Null
end if
oRecordset.Open strSQL, oADO
' If the recordset has at least one row, no problem
If Not oRecordset.EOF Then
arrayBranch = oRecordset.GetRows
Session("branch") = arrayBranch
' Otherwise the array is the empty set
Else
Session("branch") = Null
End If
end if
If Err Then
getBranchActivities = False
SetError "getBranchActivities", Err.number, Err.description
Session(cChangeInfoError) = "getBranchActivities" & Err.number & " " & Err.Description & " "
Exit Function
End If
' If we get here, we're true
getBranchActivities = True
End Function
Function addMatrixInfo()
' Take care of errors
'On Error Resume Next
addMatrixInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, objLookup, blnError, iLengthActivity, iLengthActivityID, idColumn2, dataColumn2
Dim arrayActivityID, arrayActivity, i, arrItems
blnError = False
iLengthActivityID = Len(Request.Form("DataColumn2"))
iLengthActivity = Len(Request.Form("TextColumn2"))
if iLengthActivityID <> "" and iLengthActivity <> 0 then
idColumn2 = Left(Request.Form("DataColumn2"), iLengthActivityID-1)
dataColumn2 = Left(Request.Form("TextColumn2"), iLengthActivity-1)
arrayActivityId = split(Trim(idColumn2), ",")
arrayActivity = split(Trim(dataColumn2), ",")
end if
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "addMatrixInfo", Err.number, Err.Description
Exit Function
End If
If deleteMatrixInfo() Then
If Not IsArray(arrayActivity) or Not IsArray(arrayActivityID) Then
blnError = True
Else
' Create the dictionary to hash the values we get
Set objLookup = CreateObject("Scripting.Dictionary")
For i = 0 To UBound(arrayActivity)
objLookup.Add arrayActivity(i), arrayActivityID(i)
Next
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "addMatrixInfo", Err.number, Err.Description
Exit Function
End If
'Try to retrieve the proper recordset data
objRecordset.CursorLocation = adUseClient
objRecordset.Open db_MATRIX, objDBConnection, adOpenDynamic, adLockPessimistic, adCmdTable
for i = 0 to objLookup.Count - 1
' Add a row
objRecordset.AddNew
' Then set the fields
objRecordset(db_MATRIX_branchid) = Trim( Request.Form("Branch") )
objRecordset(db_MATRIX_activityid) = objLookup.Item(arrayActivity(i))
objRecordset.Update
'response.write "Items " & objLookup.Item(arrayActivity(i)) & " "
next
End If
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "addMatrixInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
End If
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "addMatrixInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
addMatrixInfo = True
End Function
Function deleteMatrixInfo()
' Take care of error handling
'On Error Resume Next
deleteMatrixInfo = False
' Dim the variables we'll need.
Dim strConstraint, intID
' Check to make sure an ID was passed
If Request.Form("branch") = "" Then Exit Function
intID = Request.Form("branch")
' Construct the constraint
strConstraint = db_MATRIX_branchid & " = " & intID
' Then try to delete the proper row. If the delete is unsuccessful, exit the function returning false.
If Not deleteRows( db_strConn, db_MATRIX, strConstraint ) Then Exit Function
' If all this worked, assume success.
deleteMatrixInfo = True
End Function
' #############################################################################################################################
' ## Function : getITNInfo()
' ## Date : 7/6/2000
' ## Author : Chris McCarty
' ## Purpose : Sets the info in the ITN database to session variables
' #############################################################################################################################
Function getITNInfo()
'On Error Resume Next
Dim oADO, oRecordset, strSQL, bool_ADO, bool_REC, arrayITN
bool_ADO = getADO(oAdo) ' get connection object
bool_REC = getRecordset(oRecordset) ' get connection objec
getITNInfo = false
if ((bool_ADO = true) and (bool_REC = true)) then ' test to see if we can use the connection objects
strSQL = sqlITN & "order by " & db_ITN_sDate & " desc"
oADO.Open db_strConn ' open connection to db
oRecordset.Open strSQL, oADO ' open recordset using SQL statement
' If the recordset has at least one row, no problem
If Not oRecordSet.EOF Then
arrayITN = oRecordSet.GetRows
Session("itn") = arrayITN
' Otherwise the array is the empty set
Else
Session("itn") = Null
End If
end if
If Err Then
getITNInfo = False
SetError "getYOCInfo", Err.number, Err.description
Session(cChangeInfoError) = "getYOC" & Err.number & " " & Err.Description & " "
Exit Function
End If
' If we get here, we're true
getITNInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: deleteITNInfo
' Params: None
' Expects: Request.Form collection to contain an "id" entry. This is the id to be deleted
' Returns: True if the delete was successful. False if not.
' Effects: Deletes the story with the specified id from the ITN table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function deleteITNInfo()
' Take care of error handling
'On Error Resume Next
deleteITNInfo = False
' Dim the variables we'll need.
Dim strConstraint, intID
' Check to make sure an ID was passed
If Request.Form("id") = "" Then Exit Function
intID = Request.Form("id")
' Construct the constraint
strConstraint = db_ITN_id & " = '" & intID & "'"
' Then try to delete the proper row. If the delete is unsuccessful, exit the function returning false.
If Not deleteRows( db_strConn, db_ITN, strConstraint ) Then Exit Function
' If all this worked, assume success.
deleteITNInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: addITNInfo
' Params: None
' Expects: A Request object that results from a form of method "post" and enctype "multipart/form-data".
' This form must have fields "title", "subtitle", "story", "month", "day", "year", "photo" (a file), and "photo_changed"
' Also a variable, strdNum (the user's district number) is assumed to have been set in the calling page.
' Returns: True if the story is succesfully added. False if not.
' Effects: Inserts the inputted story into the ITN table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function addITNInfo()
' Take care of errors
'On Error Resume Next
addITNInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup, blnPhotoChanged, strImgDirectory, strPhotoFilename, dtmDate
Dim strUser
strUser = Session(USER)
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Look to see if the photo was changed
strImgDirectory = Server.MapPath(NEWS_DIR) & "/" & cImages
If objLookup("photo_changed").strData_ = "YES" And Not objLookup("photo").blnIsNull_ Then
blnPhotoChanged = True
Else
blnPhotoChanged = False
End If
' Construct the date from the 3 parts
dtmDate = CDate( objLookup("month").strData_ & "/" & objLookup("day").strData_ & "/" & objLookup("year").strData_ )
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "addITNInfo", Err.number, Err.Description
Exit Function
End If
' Try to retrieve the proper recordset data
objRecordset.CursorLocation = adUseClient
objRecordset.Open db_ITN, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdTable
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "addITNInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Add a row
objRecordset.AddNew
' Then set the fields
objRecordset(db_ITN_sTitle) = Trim( objLookup("title").strData_ )
objRecordset(db_ITN_sSubtitle) = Trim( objLookup("subtitle").strData_ )
objRecordset(db_ITN_sStory) = Trim( objLookup("story").strData_ )
objRecordset(db_ITN_sDate) = dtmDate
objRecordset("InputBy") = strUser
objRecordset("InputDate") = Now()
objRecordset.Update
' We only have write the image if the images were updated
If blnPhotoChanged Then
' First create the name for the new image
strPhotoFilename = ITN_PHOTO_NAME & objRecordset(db_ITN_id) & "." & getFilenameExtension( objLookup("photo").strFilename_ )
' Then update the field in the database
objRecordset(db_ITN_sPhoto) = strPhotoFilename
' Then try to write the file. If the write fails we have to exit the function unsuccessfully.
If Not writeFile( strImgDirectory, strPhotoFilename, objLookup("photo").strData_ ) Then Exit Function
Else
objRecordset(db_ITN_sPhoto) = NO_PHOTO
End If
' Finally update the database
objRecordset.Update
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "addITNInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
addITNInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: modifyITNInfo
' Params: None
' Expects: A Request object that results from a form of method "post" and enctype "multipart/form-data".
' This form must have fields "title", "subtitle", "story", "month", "day", "year", "photo" (a file), and "photo_changed"
' Also, unlike the add method, a field "id" is expected to determine which record is to be modified.
' A variable arrayITN is expected to have been defined in the calling page and should contain the entire
' contents of the ITN table in a 2D array.
' Returns: True if the story is succesfully added. False if not.
' Effects: Modifies the appropriate story in the ITN table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function modifyITNInfo()
' Take care of errors
'On Error Resume Next
modifyITNInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup, blnPhotoChanged, strImgDirectory, strPhotoFilename, strOldPhotoFilename
Dim intNumRows, i, intRowWithID, intID, dtmDate
Dim arrayITN
Dim strUser
strUser = Session(USER)
arrayITN = Session("itn")
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Deal with the image situation
strImgDirectory = Server.MapPath(NEWS_DIR) & "/" & cImages
If objLookup("photo_changed").strData_ = "YES" And Not objLookup("photo").blnIsNull_ Then
blnPhotoChanged = True
Else
blnPhotoChanged = False
End If
' Construct the date from the 3 parts
dtmDate = CDate( objLookup("month").strData_ & "/" & objLookup("day").strData_ & "/" & objLookup("year").strData_ )
' Determine which row of the Session array contains the relavent entry
intID = objLookup("id").strData_
intNumRows = UBound(arrayITN,2) ' Count the number of rows
For i = 0 To intNumRows
If CInt(intID) = CInt( arrayITN(ITN_ID_INDEX,i) ) Then
intRowWithID = i
Exit For
End If
Next
' Check to see if anything has actually been changed. If it has, we have to try and connect to the
' database. Otherwise, we don't have to do anything. That's easy.
If arrayITN(ITN_TITLE_INDEX, intRowWithID) <> Trim( objLookup("title").strData_ ) _
Or arrayITN(ITN_SUBTITLE_INDEX, intRowWithID) <> Trim( objLookup("subtitle").strData_ ) _
Or arrayITN(ITN_STORY_INDEX, intRowWithID) <> Trim( objLookup("story").strData_ ) _
Or CDate( arrayITN(ITN_DATE_INDEX, intRowWithID) ) <> dtmDate _
Or blnPhotoChanged _
Or objLookup("photo_usage_changed").strData_ = "YES" Then
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "modifyITNInfo", Err.number, Err.Description
Exit Function
End If
' With that successful, construct the SQL statement and retrieve the desired row into the recordset
strSQL = SQL_ITN_INFO & objLookup("id").strData_
' And try to retrieve the proper recordset data
objRecordset.Open strSQL, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdText
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "modifyITNInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Make sure we have actual returned a row
If objRecordset.EOF Then Exit Function
' Update the name and bio fields
objRecordset(db_ITN_sTitle) = Trim( objLookup("title").strData_ )
objRecordset(db_ITN_sSubtitle) = Trim( objLookup("subtitle").strData_ )
objRecordset(db_ITN_sStory) = Trim( objLookup("story").strData_ )
objRecordset(db_ITN_sDate) = dtmDate
objRecordset("ModifiedBy") = strUser
objRecordset("ModifiedDate") = Now()
' We only have to update each image field if the images were updated
If blnPhotoChanged Then
' We have to then check to see if the user really wants the image
If objLookup("photo_use").strData_ = "YES" Then
' First create the filename for the new file
strPhotoFilename = ITN_PHOTO_NAME & objRecordset(db_ITN_id) & "." & getFilenameExtension( objLookup("photo").strFilename_ )
' Then decide if we need to delete the old file, that is do the old and new files have different names?
' If they do, the new one will simply overwrite the old one. Otherwise we have to specifically delete the old one
strOldPhotoFilename = objRecordset(db_ITN_sPhoto)
If Trim( strPhotoFilename ) <> Trim ( strOldPhotoFilename ) And Trim( strOldPhotoFilename ) <> NO_PHOTO Then
queueForDelete( strImgDirectory & strOldPhotoFilename )
End If
' First update the field in the database
objRecordset(db_ITN_sPhoto) = strPhotoFilename
' Make sure this photo is not going to get deleted
removeFromDeleteQueue( strImgDirectory & strPhotoFilename )
' Then try to write the file. If the write fails we have to exit the function unsuccessfully.
If Not writeFile( strImgDirectory, strPhotoFilename, objLookup("photo").strData_ ) Then Exit Function
End If
End If
' Then write to the database if the image is not to be used
If objLookup("photo_use").strData_ = "NO" And Trim( objRecordset(db_ITN_sPhoto) ) <> NO_PHOTO Then
' First delete the old image file
queueForDelete( strImgDirectory & objRecordset(db_ITN_sPhoto) )
' Then set the field
objRecordset(db_ITN_sPhoto) = NO_PHOTO
End If
' Finally update the database
objRecordset.Update
End If
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "modifyITNInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
modifyITNInfo = True
End Function
Function getBranchInfo()
'On Error Resume Next
Dim oADO, oRecordset, strSQL, bool_ADO, bool_REC, arrayBranch
bool_ADO = getADO(oAdo) ' get connection object
bool_REC = getRecordset(oRecordset) ' get connection objec
getBranchInfo = false
if ((bool_ADO = true) and (bool_REC = true)) then ' test to see if we can use the connection objects
strSQL = sqlBranch
oADO.Open db_strConn ' open connection to db
oRecordset.Open strSQL, oADO ' open recordset using SQL statement
' If the recordset has at least one row, no problem
If Not oRecordSet.EOF Then
arrayBranch = oRecordSet.GetRows
Session("branch") = arrayBranch
' Otherwise the array is the empty set
Else
Session("branch") = Null
End If
end if
If Err Then
getBranchInfo = False
SetError "getBranchInfo", Err.number, Err.description
Session(cChangeInfoError) = "getBranch" & Err.number & " " & Err.Description & " "
Exit Function
End If
' If we get here, we're true
getBranchInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: addBranchInfo
' Params: None
' Returns: True if the branch is succesfully added. False if not.
' Effects: Inserts the inputted branch into the Branches table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function addBranchInfo()
' Take care of errors
'On Error Resume Next
addBranchInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "addBranchInfo", Err.number, Err.Description
Exit Function
End If
' Try to retrieve the proper recordset data
objRecordset.CursorLocation = adUseClient
objRecordset.Open db_BRANCH, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdTable
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "addBranchInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Add a row
objRecordset.AddNew
' Then set the fields
objRecordset(db_BRANCH_Name) = Trim( objLookup("BName").strData_ )
objRecordset(db_BRANCH_Phone) = Trim( objLookup("BPhone").strData_ )
objRecordset(db_BRANCH_Abbrev) = Trim( objLookup("BAbbrev").strData_ )
objRecordset.Update
' Finally update the database
objRecordset.Update
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "addBranchInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
addBranchInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: modifyBranchInfo
' Params: None
' Returns: True if the branch is succesfully updated. False if not.
' Effects: Modifies the appropriate branch in the Branches table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function modifyBranchInfo()
' Take care of errors
'On Error Resume Next
modifyBranchInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup
Dim intNumRows, i, intRowWithID, intID
Dim arrayBranch
arrayBranch = Session("branch")
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Determine which row of the Session array contains the relavent entry
intID = objLookup("id").strData_
intNumRows = UBound(arrayBranch,2) ' Count the number of rows
For i = 0 To intNumRows
If CInt(intID) = CInt( arrayBranch(BRANCH_ID_INDEX,i) ) Then
intRowWithID = i
Exit For
End If
Next
' Check to see if anything has actually been changed. If it has, we have to try and connect to the
' database. Otherwise, we don't have to do anything. That's easy.
If arrayBranch(BRANCH_NAME_INDEX, intRowWithID) <> Trim( objLookup("BName").strData_ ) _
Or arrayBranch(BRANCH_PHONE_INDEX, intRowWithID) <> Trim( objLookup("BPhone").strData_ ) _
Or arrayBranch(BRANCH_ABBREV_INDEX, intRowWithID) <> Trim( objLookup("BAbbrev").strData_ ) _
Then
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "modifyBranchInfo", Err.number, Err.Description
Exit Function
End If
' With that successful, construct the SQL statement and retrieve the desired row into the recordset
strSQL = SQL_BRANCH_INFO & objLookup("id").strData_
' And try to retrieve the proper recordset data
objRecordset.Open strSQL, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdText
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "modifyBranchInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Make sure we have actual returned a row
If objRecordset.EOF Then Exit Function
' Update the branch fields
objRecordset(db_BRANCH_Name) = Trim( objLookup("BName").strData_ )
objRecordset(db_BRANCH_Phone) = Trim( objLookup("BPhone").strData_ )
objRecordset(db_BRANCH_Abbrev) = Trim( objLookup("BAbbrev").strData_ )
' Finally update the database
objRecordset.Update
End If
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "modifyBranchInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
modifyBranchInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: deleteBranchInfo
' Params: None
' Expects: Request.Form collection to contain an "id" entry. This is the id to be deleted
' Returns: True if the delete was successful. False if not.
' Effects: Deletes the branch with the specified id from the Branches table and also the Matrix Table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function deleteBranchInfo()
' Take care of error handling
'On Error Resume Next
deleteBranchInfo = False
' Dim the variables we'll need.
Dim strBranchConstraint, strMatrixConstraint, intID
' Check to make sure an ID was passed
If Request.Form("id") = "" Then Exit Function
intID = Request.Form("id")
' Construct the constraint
strBranchConstraint = db_BRANCH_id & " = '" & intID & "'"
strMatrixConstraint = db_MATRIX_branchid & " = '" & intID & "'"
' Then try to delete the proper row from the branches table. If the delete is unsuccessful, exit the function returning false.
If Not deleteRows( db_strConn, db_BRANCH, strBranchConstraint ) Then Exit Function
'Then try to delete the proper rows from the matrix table. If the delete is unsuccessful, exit the function returning false.
If Not deleteRows( db_strConn, db_MATRIX, strMatrixConstraint ) Then Exit Function
' If all this worked, assume success.
deleteBranchInfo = True
End Function
Function getActivityInfo()
'On Error Resume Next
Dim oADO, oRecordset, oRecordset1, strSQL, strSQL1, bool_ADO, bool_REC, bool_REC1, arrayActivity, arrayProgram
bool_ADO = getADO(oAdo) ' get connection object
bool_REC = getRecordset(oRecordset) ' get connection objec
bool_REC1 = getRecordset(oRecordset1)
getActivityInfo = false
if ((bool_ADO = true) and (bool_REC = true) and (bool_REC1 = true)) then ' test to see if we can use the connection objects
strSQL = sqlActivity
strSQL1 = sqlActProgram
oADO.Open db_strConn ' open connection to db
oRecordset.Open strSQL, oADO ' open recordset using SQL statement
oRecordset1.Open strSQL1, oADO
' If the recordset has at least one row, no problem
If Not oRecordSet.EOF Then
arrayActivity = oRecordSet.GetRows
Session("activity") = arrayActivity
' Otherwise the array is the empty set
Else
Session("activity") = Null
End If
If Not oRecordSet1.EOF Then
arrayProgram = oRecordSet1.GetRows
Session("program") = arrayProgram
' Otherwise the array is the empty set
Else
Session("program") = Null
End If
end if
If Err Then
getActivityInfo = False
SetError "getActivityInfo", Err.number, Err.description
Session(cChangeInfoError) = "getActivity" & Err.number & " " & Err.Description & " "
Exit Function
End If
' If we get here, we're true
getActivityInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: addActivityInfo
' Params: None
' Returns: True if the activity is succesfully added. False if not.
' Effects: Inserts the inputted activity into the activity table.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function addActivityInfo()
' Take care of errors
'On Error Resume Next
addActivityInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "addActivityInfo", Err.number, Err.Description
Exit Function
End If
' Try to retrieve the proper recordset data
objRecordset.CursorLocation = adUseClient
objRecordset.Open db_ACTIVITY, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdTable
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "addActivityInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Add a row
objRecordset.AddNew
' Then set the fields
objRecordset(db_ACTIVITY_Name) = Trim( objLookup("AName").strData_ )
objRecordset(db_ACTIVITY_ProgramID) = Trim( objLookup("AProgramId").strData_ )
objRecordset.Update
' Finally update the database
objRecordset.Update
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "addActivityInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
addActivityInfo = True
End Function
Function modifyActivityInfo()
' Take care of errors
'On Error Resume Next
modifyActivityInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup
Dim intNumRows, i, intRowWithID, intID
Dim arrayActivity
arrayActivity = Session("activity")
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Determine which row of the Session array contains the relavent entry
intID = objLookup("id").strData_
intNumRows = UBound(arrayActivity,2) ' Count the number of rows
For i = 0 To intNumRows
If CInt(intID) = CInt( arrayActivity(ACTIVITY_ID_INDEX,i) ) Then
intRowWithID = i
Exit For
End If
Next
' Check to see if anything has actually been changed. If it has, we have to try and connect to the
' database. Otherwise, we don't have to do anything. That's easy.
If arrayActivity(ACTIVITY_NAME_INDEX, intRowWithID) <> Trim( objLookup("AName").strData_ ) _
Or arrayActivity(ACTIVITY_PROGRAMID_INDEX, intRowWithID) <> Trim( objLookup("AProgramId").strData_ ) Then
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "modifyActivityInfo", Err.number, Err.Description
Exit Function
End If
' With that successful, construct the SQL statement and retrieve the desired row into the recordset
strSQL = SQL_ACTIVITY_INFO & objLookup("id").strData_
' And try to retrieve the proper recordset data
objRecordset.Open strSQL, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdText
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "modifyActivityInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Make sure we have actual returned a row
If objRecordset.EOF Then Exit Function
' Update the branch fields
objRecordset(db_ACTIVITY_Name) = Trim( objLookup("AName").strData_ )
objRecordset(db_ACTIVITY_ProgramID) = Trim( objLookup("AProgramId").strData_ )
' Finally update the database
objRecordset.Update
End If
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "modifyActivityInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
modifyActivityInfo = True
End Function
Function deleteActivityInfo()
' Take care of error handling
'On Error Resume Next
deleteActivityInfo = False
' Dim the variables we'll need.
Dim strConstraint, intID
' Check to make sure an ID was passed
If Request.Form("id") = "" Then Exit Function
intID = Request.Form("id")
' Construct the constraint
strConstraint = db_ACTIVITY_id & " = '" & intID & "'"
' Then try to delete the proper row from the activity table. If the delete is unsuccessful, exit the function returning false.
If Not deleteRows( db_strConn, db_ACTIVITY, strConstraint ) Then Exit Function
' If all this worked, assume success.
deleteActivityInfo = True
End Function
Function getProgramInfo()
'On Error Resume Next
Dim oADO, oRecordset, strSQL, bool_ADO, bool_REC, arrayProgram
bool_ADO = getADO(oAdo) ' get connection object
bool_REC = getRecordset(oRecordset) ' get connection objec
getProgramInfo = false
if ((bool_ADO = true) and (bool_REC = true)) then ' test to see if we can use the connection objects
strSQL = sqlActProgram
oADO.Open db_strConn ' open connection to db
oRecordset.Open strSQL, oADO ' open recordset using SQL statement
' If the recordset has at least one row, no problem
If Not oRecordSet.EOF Then
arrayProgram = oRecordSet.GetRows
Session("program") = arrayProgram
' Otherwise the array is the empty set
Else
Session("program") = Null
End If
end if
If Err Then
getProgramInfo = False
SetError "getProgramInfo", Err.number, Err.description
Session(cChangeInfoError) = "getProgram" & Err.number & " " & Err.Description & " "
Exit Function
End If
' If we get here, we're true
getProgramInfo = True
End Function
Function addProgramInfo()
' Take care of errors
'On Error Resume Next
addProgramInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "addProgramInfo", Err.number, Err.Description
Exit Function
End If
' Try to retrieve the proper recordset data
objRecordset.CursorLocation = adUseClient
objRecordset.Open db_PROGRAM, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdTable
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "addProgramInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Add a row
objRecordset.AddNew
' Then set the fields
objRecordset(db_PROGRAM_Name) = Trim( objLookup("PName").strData_ )
objRecordset.Update
' Finally update the database
objRecordset.Update
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "addProgramInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
addProgramInfo = True
End Function
Function modifyProgramInfo()
' Take care of errors
'On Error Resume Next
modifyProgramInfo = False
' Declare some variables to use
Dim objDBConnection, objRecordset, strSQL, objLookup
Dim intNumRows, i, intRowWithID, intID
Dim arrayProgram
arrayProgram = Session("program")
' Parse the http header. This is expected to be from a form of enctype multipart form/data
' If this doesn't succeed, we have no choice but to exit the write function
If Not parseHeader( objLookup ) Then Exit Function
' Determine which row of the Session array contains the relavent entry
intID = objLookup("id").strData_
intNumRows = UBound(arrayProgram,2) ' Count the number of rows
For i = 0 To intNumRows
If CInt(intID) = CInt( arrayProgram(PROGRAM_ID_INDEX,i) ) Then
intRowWithID = i
Exit For
End If
Next
' Check to see if anything has actually been changed. If it has, we have to try and connect to the
' database. Otherwise, we don't have to do anything. That's easy.
If arrayProgram(PROGRAM_NAME_INDEX, intRowWithID) <> Trim( objLookup("PName").strData_ ) Then
' Create the ADO and Recordset objects... if either screws up, exit the function
If Not ( GetADO( objDBConnection ) And GetRecordSet( objRecordset ) ) Then Exit Function
' Then try to connect to the database
objDBConnection.Open db_strConn
' Check for errors on with this connection attempt
If Err.Number Then
If Not HaveError() Then SetError "modifyProgramInfo", Err.number, Err.Description
Exit Function
End If
' With that successful, construct the SQL statement and retrieve the desired row into the recordset
strSQL = SQL_PROGRAM_INFO & objLookup("id").strData_
' And try to retrieve the proper recordset data
objRecordset.Open strSQL, objDBConnection, adOpenDynamic, adLockOptimistic, adCmdText
' Again check for errors after attempting to interact with the database
If Err.Number Then
If Not HaveError() Then SetError "modifyProgramInfo", Err.number, Err.Description
objDBConnection.Close ' Close the (presumably) open database connection
Exit Function
End If
' Make sure we have actual returned a row
If objRecordset.EOF Then Exit Function
' Update the branch fields
objRecordset(db_PROGRAM_Name) = Trim( objLookup("PName").strData_ )
' Finally update the database
objRecordset.Update
End If
' Close our connections
objRecordset.Close
objDBConnection.Close
' Destroy everything we new'd
Set objRecordset = Nothing
Set objDBConnection = Nothing
Set objLookup = Nothing
' Check for errors once more
If Err.Number Then
If Not HaveError() Then SetError "modifyProgramInfo", Err.number, Err.Description
Exit Function
End If
' And finally return true if all that succeeded.
modifyProgramInfo = True
End Function
Function deleteProgramInfo()
' Take care of error handling
'On Error Resume Next
deleteProgramInfo = False
' Dim the variables we'll need.
Dim strProgramConstraint, strActivityConstraint, intID
' Check to make sure an ID was passed
If Request.Form("id") = "" Then Exit Function
intID = Request.Form("id")
' Construct the constraint
strActivityConstraint = db_ACTIVITY_Programid & " = '" & intID & "'"
strProgramConstraint = db_PROGRAM_id & " = '" & intID & "'"
' Then try to delete the proper row from the branches table. If the delete is unsuccessful, exit the function returning false.
If Not deleteRows( db_strConn, db_PROGRAM, strProgramConstraint ) Then Exit Function
'Then try to delete the proper rows from the matrix table. If the delete is unsuccessful, exit the function returning false.
If Not deleteRows( db_strConn, db_ACTIVITY, strActivityConstraint ) Then Exit Function
' If all this worked, assume success.
deleteProgramInfo = True
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: queueForDelete
' Params: A filename to delete. This should be the full path name including the file.
' Returns: None
' Effects: Adds the file to the array of files to be deleted when the current session ends.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub queueForDelete( strFilename )
' First set a variable to use
Dim i, strDeletionArray, intNumFiles, strNewArray(), strExpandedArray(), blnFileAlreadyInQueue
' Check to see if we have to new the array
If IsEmpty( Session(DELETION_QUEUE) ) Then
ReDim strNewArray(DELETION_QUEUE_MAX_SIZE)
Session(DELETION_QUEUE) = strNewArray
Session(DELETION_QUEUE_SIZE) = 0
End If
' Set our array of items to be deleted and the num items
strDeletionArray = Session(DELETION_QUEUE)
intNumFiles = Session(DELETION_QUEUE_SIZE)
' Set other variables
blnFileAlreadyInQueue = False
' Then check to see if the file needs to be inserted
For i = 0 To intNumFiles - 1
If Trim( strDeletionArray(i) ) = Trim( strFilename ) Then
blnFileAlreadyInQueue = True
Exit For
End If
Next
' If the file is not already there then insert
If Not blnFileAlreadyInQueue Then
' Check to see if the array has to be expanded
If intNumFiles > UBound(strDeletionArray) Then
ReDim strExpandedArray( intNumFiles * 2 )
For i = 0 To UBound(strDeletionArray)
strExpandedArray(i) = strDeletionArray(i)
Next
strDeletionArray = strExpandedArray
End If
intNumFiles = intNumFiles + 1
strDeletionArray(intNumFiles - 1) = Trim( strFilename )
' Then set the session variables to their new values
Session(DELETION_QUEUE) = strDeletionArray
Session(DELETION_QUEUE_SIZE) = intNumFiles
End If
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: deleteQueuedFiles
' Params: None
' Returns: True if successful. False if not.
' Effects: Attempts to delete files that have been placed in the deletion queue
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function deleteQueuedFiles()
' First decide if any files need to be deleted. Does the deletion queue exist?
If Not IsEmpty( Session(DELETION_QUEUE) ) Then
' First create an array that is exactly the right size
ReDim strFilesArray(Session(DELETION_QUEUE_SIZE) - 1)
' Then populate the array
Dim i
For i = 0 To Session(DELETION_QUEUE_SIZE) - 1
strFilesArray(i) = Session(DELETION_QUEUE)(i)
Next
deleteQueuedFiles = deleteFile( strFilesArray )
Else
deleteQueuedFiles = True
End If
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function: removeFromDeleteQueue
' Params: A filename to remove from the deletion queue
' Returns: None
' Effects: If the filename is in the deletion queue, remove it. Otherwise do nothing.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub removeFromDeleteQueue( strFilename )
' Initially just check to make sure that the deletion queue has even been created
If Not IsEmpty( Session(DELETION_QUEUE) ) Then
' Set up some variables to use
Dim blnIsMember, strResizedFileArray(), intIndex, intNewArrayIndex
' First we have to decide if the file is in the queue already
blnIsMember = False
For intIndex = 0 To Session(DELETION_QUEUE_SIZE) - 1
If Trim( Session(DELETION_QUEUE)(intIndex) ) = Trim( strFilename ) Then blnIsMember = True
Next
' If it is in the queue, we make an array with one fewer indices and then populate it
If blnIsMember Then
intNewArrayIndex = 0
ReDim strResizedFileArray(Session(DELETION_QUEUE_SIZE) - 2)
For intIndex = 0 To Session(DELETION_QUEUE_SIZE) - 1
If Trim( Session(DELETION_QUEUE)(intIndex) ) <> Trim( strFilename ) Then
strResizedFileArray(intNewArrayIndex) = Trim( strFilename )
intNewArrayIndex = intNewArrayIndex + 1
End If
Next
Session(DELETION_QUEUE_SIZE) = Session(DELETION_QUEUE_SIZE) - 1
Session(DELETION_QUEUE) = strResizedFileArray
End If
End If
End Sub
Function getBranchPage()
Dim strFullPath, strFileNameOnly, id
strFullPath = Request.ServerVariables("PATH_INFO")
strFileNameOnly = Mid(strFullPath, InstrRev(strFullPath, "/")+1, Len(strFullPath))
id = Request.QueryString("id")
if strFileNameOnly = "albany.asp" or id = 1 then
getBranchPage = 1
elseif strFileNameOnly = "empire_st_plaza.asp" or id = 5 then
getBranchPage = 5
elseif strFileNameOnly = "guilderland.asp" or id = 9 then
getBranchPage = 9
elseif strFileNameOnly = "schenectady.asp" or id = 4 then
getBranchPage = 4
elseif strFileNameOnly = "troy.asp" or id = 8 then
getBranchPage = 8
elseif strFileNameOnly = "parkside.asp" or id = 3 then
getBranchPage = 3
elseif strFileNameOnly = "southern_saratoga.asp" or id = 7 then
getBranchPage = 7
elseif strFileNameOnly = "chingachgook.asp" or id = 2 then
getBranchPage = 2
elseif strFileNameOnly = "east_greenbush.asp" or id = 16 then
getBranchPage = 16
elseif strFileNameOnly = "bethlehem.asp" or id = 2 then
getBranchPage = 17
else
getBranchPage = 0
end if
End Function
%>

Pine Bush Triathlon Home
Registration & Schedule
About the Race
Travel Directions
The Dream Team to Beat
Sponsors & Hosts
Volunteers
Race Results
Photo Gallery
Contact Us
|
|
Results
2007
Individual
Team
Age
Group Order - Female/Male
2006
Individual
Team
Age
group Order - Female/Male
2005
Individual
Team
Age group Order - Female/Male
2004
Individual
Team
Age group Order - Female/Male
2003
Individual
Team
Age group Order - Female/Male
|