<% Option Explicit %> <% Dim oConn, sConn, sAbsPath Dim sHTTPHost: sHTTPHost = Request.ServerVariables("HTTP_HOST") Dim sHTTPPort: sHTTPPort = Request.ServerVariables("SERVER_PORT") Dim blnNamedPipe: blnNamedPipe = False If InStr(sHTTPHost, "localhost") > 0 AND sHTTPPort = "80" Then sAbsPath = "http://" & sHTTPHost & "/ie/2007-12-20" blnNamedPipe = True ElseIf InStr(sHTTPHost, "localhost") > 0 AND sHTTPPort = "8080" Then sAbsPath = "http://" & sHTTPHost & "/interexcel/ie/2007-12-20" ElseIf InStr(sHTTPHost, "interexcel.co.za") > 0 Then sAbsPath = "http://www.interexcel.co.za/clients/interexcel" Else sAbsPath = "http://www.interexcel.co.za" End If Sub openConn() Set oConn = Server.CreateObject("ADODB.Connection") If NOT blnNamedPipe Then sConn = "Driver={SQL Server};Server=(local);Database=interexcel;Uid=interexcel;Pwd=iedbpass1" Else sConn = "Driver={SQL Server};Server=PIETERPC\PIETERPC;Database=interexcel;Uid=interexcel;Pwd=iedbpass1" End If oConn.Open sConn End Sub Sub closeConn() If IsObject(oConn) Then On Error Resume Next If oConn.State = 1 Then oConn.Close End If Set oConn = Nothing Err.Clear On Error Goto 0 End If End Sub %> <% '-------------------------------------------------------------------------- ' Check if a value is found in an array '-------------------------------------------------------------------------- Function in_array(element, arr) Dim iCnt If IsArray(arr) Then For iCnt = LBound(arr) To Ubound(arr) If IsNumeric(arr(iCnt)) AND IsNumeric(element) Then If CInt(arr(iCnt)) = CInt(element) Then in_array = True Exit Function Else in_array = False End If Else If Trim(arr(iCnt)) = Trim(element) Then in_array = True Exit Function Else in_array = False End If End If Next Else If IsNumeric(element) AND IsNumeric(arr) Then If CInt(element) = CInt(arr) Then in_array = True Exit Function Else in_array = False End If Else If Trim(element) = Trim(arr) Then in_array = True Exit Function Else in_array = False End If End If End If End Function '-------------------------------------------------------------------------- ' Check if user is admin '-------------------------------------------------------------------------- Function isAdmin() Dim AdminIDSession: AdminIDSession = Request.Cookies("InterexcelAdminID") isAdmin = False If AdminIDSession <> "" Then isAdmin = True End If End Function %> <% '-------------------------------------------------------------------------- ' Return pagination string '-------------------------------------------------------------------------- ' Syntax: Response.Write (pagination(byVal current_page, byVal objRS.PageCount, byVal objRS.RecordCount) '-------------------------------------------------------------------------- ' Dependancies: CSS styles which may be found in /admin/css/global.css and /admin/css/[theme].css '-------------------------------------------------------------------------- Function pagination(byVal pg, byVal total_pages, byVal total_records) Dim url, oncelink, prevlink, nextlink, lastlink Dim str_pages: str_pages = "" On Error Resume Next pg = CLng(pg) On Error GoTo 0 '-- build URL, remove old pg data -- Dim oRegExp: Set oRegExp = New RegExp oRegExp.Pattern = "(&|\?)?pg=[^&]*(&|$)" oRegExp.IgnoreCase = True oRegExp.Global = True url = oRegExp.Replace(Request.ServerVariables("SCRIPT_NAME") & "?" & Request.ServerVariables("QUERY_STRING"), "$1") Set oRegExp = Nothing If (Right(url, 1) = "&") Then url = Left(url, Len(url) - 1) If (Right(url, 1) = "?") Then url = Left(url, Len(url) - 1) If (InStr(url, "?") > 0) Then url = url & "&" Else url = url & "?" End If url = Replace(url, "&", "&") If (pg < total_pages) AND (pg > 1) Then oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" End If If (pg = 1) Then oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" End If If (pg = total_pages) Then If (total_pages = 1) Then oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" Else oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" End If End If str_pages = "" str_pages = str_pages & "
" & vbCrLf str_pages = str_pages & "
Total records: " str_pages = str_pages & total_records str_pages = str_pages & "
" & vbCrLf str_pages = str_pages & "
" & vbCrLf str_pages = str_pages & oncelink & vbCrLf str_pages = str_pages & prevlink & vbCrLf str_pages = str_pages & "Page " & pg & "/" & total_pages & "" & vbCrLf str_pages = str_pages & nextlink & vbCrLf str_pages = str_pages & lastlink & vbCrLf str_pages = str_pages & "
" str_pages = str_pages & "
" pagination = str_pages End Function Function cat_pagination(byVal pg, byVal total_pages, byVal total_records) Dim url, oncelink, prevlink, nextlink, lastlink Dim str_pages: str_pages = "" pg = CInt(pg) '-- build URL, remove old pg data -- Dim oRegExp : Set oRegExp = New RegExp oRegExp.Pattern = "(&|\?)?pg=[^&]*(&|$)" oRegExp.IgnoreCase = True oRegExp.Global = True url = oRegExp.Replace(Request.ServerVariables("SCRIPT_NAME") & "?" & Request.ServerVariables("QUERY_STRING"), "$1") Set oRegExp = Nothing If (Right(url, 1) = "&") Then url = Left(url, Len(url) - 1) If (Right(url, 1) = "?") Then url = Left(url, Len(url) - 1) If (InStr(url, "?") > 0) Then url = url & "&" Else url = url & "?" End If url = Replace(url, "&", "&") If (pg < total_pages) AND (pg > 1) Then oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" End If If (pg = 1) Then oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" End If If (pg = total_pages) Then If (total_pages = 1) Then oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" Else oncelink = "<" prevlink = "«" nextlink = "»" lastlink = ">" End If End If str_pages = "" str_pages = str_pages & "
" & vbCrLf str_pages = str_pages & "
" & vbCrLf str_pages = str_pages & oncelink & vbCrLf str_pages = str_pages & prevlink & vbCrLf str_pages = str_pages & "Page " & pg & "/" & total_pages & "" & vbCrLf str_pages = str_pages & nextlink & vbCrLf str_pages = str_pages & lastlink & vbCrLf str_pages = str_pages & "
" str_pages = str_pages & "
" cat_pagination = str_pages End Function %> <% '-------------------------------------------------------------------------- ' Convert a time in the past to a human-readable format '-------------------------------------------------------------------------- ' Syntax: str_time = time_since(byVal date_from_database) '-------------------------------------------------------------------------- Function time_since (byVal older_date) Dim names: names = array("year", "month", "day", "hour", "minute", "second") Dim posted Dim date_today Dim str_out Dim i, j If IsDate(older_date) Then date_today = Now() posted = array (DatePart("YYYY", date_today) - DatePart("YYYY", older_date), DatePart("m", date_today) - DatePart("m", older_date), DatePart("d", date_today) - DatePart("d", date_today), DatePart("h", date_today) - DatePart("h", date_today), DatePart("n", date_today) - DatePart("n", date_today), DatePart("s", date_today) - DatePart("s", date_today)) Response.Write ("
")
		Call print_r(posted, 0)
		Response.Write ("
") Response.End j = UBound(posted) For i = 0 To j - 1 If posted(i) <> 0 Then Exit For End If Next str_out = posted(i) & " " & names(i) If posted(i) <> 1 Then str_out = str_out & "s" End If If i + 1 < 5 Then If posted(i + 1) <> 0 Then str_out = str_out & ", " & posted(i + 1) & " " & names(i + 1) If posted(i + 1) <> 1 Then str_out = str_out & "s" End If End If End If Else str_out = "Unknown date format" End If time_since = str_out End Function '-------------------------------------------------------------------------- ' Determines if a date falls on a week-end '-------------------------------------------------------------------------- Function isWeekEnd(byVal dteDate) If WeekDay(dteDate) = vbSunday OR WeekDay(dteDate) = vbSaturday Then isWeekEnd = True Else isWeekEnd = False End If End Function '-------------------------------------------------------------------------- ' Return the number of days to skip (forward) to get back to ' a work date '-------------------------------------------------------------------------- Function skipDate(byVal dteDate) If WeekDay(dteDate) = vbSunday Then skipDate = universalDate(DateAdd("d", 1, dteDate)) ElseIf WeekDay(dteDate) = vbSaturday Then skipDate = universalDate(DateAdd("d", 2, dteDate)) Else skipDate = dteDate End If End Function '-------------------------------------------------------------------------- ' Universal date: convert date to human-readable and ' database-safe date '-------------------------------------------------------------------------- Function universalDate(byVal dteDate) dim dteDay, dteMonth, dteYear ' Check to see that a valid date was passed If IsDate(dteDate) = True Then dteDay = Day(dteDate) dteMonth = Month(dteDate) dteYear = Year(dteDate) universalDate = dteYear & "-" & Right(Cstr(dteMonth + 100),2) & "-" & Right(Cstr(dteDay + 100),2) Else universalDate = Null End If End Function '-------------------------------------------------------------------------- ' Database-safe date/time '-------------------------------------------------------------------------- Function dbDate(byVal dt) dbDate = Year(dt) & Right("0" & Month(dt), 2) & Right("0" & Day(dt), 2) & " " & FormatDateTime(dt, 4) End Function '-------------------------------------------------------------------------- ' Convert a date to a UNIX timestamp '-------------------------------------------------------------------------- Function UDate(byVal oldDate) UDate = DateDiff("s", "01/01/1970 00:00:00", oldDate) End Function '-------------------------------------------------------------------------- ' Returns a date from a UNIX timestamp '-------------------------------------------------------------------------- Function unUDate(byVal intTimeStamp) unUDate = DateAdd("s", intTimeStamp, "01,01,1970 00:00:00") End Function '-------------------------------------------------------------------------- ' Extended date/time formatting function '-------------------------------------------------------------------------- Function formatDate(byVal formatting, byVal intTimeStamp) dim unUDate, A ' Test to see if intTimeStamp looks valid. If not, they have passed a normal date If NOT (IsNumeric(intTimeStamp)) Then If IsDate(intTimeStamp) Then intTimeStamp = DateDiff("S", "01/01/1970 00:00:00", intTimeStamp) Else Response.Write ("Date Invalid") Exit Function End If End If If (intTimeStamp = 0) Then unUDate = Now() Else unUDate = DateAdd("s", intTimeStamp, "01/01/1970 00:00:00") End If unUDate = Trim(unUDate) dim startM : startM = InStr(1, unUDate, "/", vbTextCompare) + 1 dim startY : startY = InStr(startM, unUDate, "/", vbTextCompare) + 1 dim startHour : startHour = InStr(startY, unUDate, " ", vbTextCompare) + 1 dim startMin : startMin = InStr(startHour, unUDate, ":", vbTextCompare) + 1 dim dateDay : dateDay = Mid(unUDate, 1, 2) dim dateMonth : dateMonth = Mid(unUDate, startM, 2) dim dateYear : dateYear = Mid(unUDate, startY, 4) dim dateHour : dateHour = Mid(unUDate, startHour, 2) dim dateMinute : dateMinute = Mid(unUDate, startMin, 2) dim dateSecond : dateSecond = Mid(unUDate, InStr(startMin, unUDate, ":", vbTextCompare) + 1, 2) formatting = Replace(formatting, "%Y", Right(dateYear, 4)) formatting = Replace(formatting, "%y", Right(dateYear, 2)) formatting = Replace(formatting, "%m", dateMonth) formatting = Replace(formatting, "%n", CInt(dateMonth)) formatting = Replace(formatting, "%F", MonthName(CInt(dateMonth))) formatting = Replace(formatting, "%M", Left(MonthName(CInt(dateMonth)), 3)) formatting = Replace(formatting, "%d", dateDay) formatting = Replace(formatting, "%j", CInt(dateDay)) formatting = Replace(formatting, "%h", Mid(unUDate, startHour, 2)) formatting = Replace(formatting, "%g", CInt(Mid(unUDate, startHour, 2))) If (CInt(dateHour) > 12) Then A = "PM" Else A = "AM" End If formatting = Replace(formatting, "%A", A) formatting = Replace(formatting, "%a", LCase(A)) If (A = "PM") Then formatting = Replace(formatting, "%H", Left("0" & dateHour - 12, 2)) formatting = Replace(formatting, "%H", dateHour) If (A = "PM") Then formatting = Replace(formatting, "%G", Left("0" & CInt(dateHour) - 12, 2)) formatting = Replace(formatting, "%G", CInt(dateHour)) formatting = Replace(formatting, "%i", dateMinute) formatting = Replace(formatting, "%I", CInt(dateMinute)) formatting = Replace(formatting, "%s", dateSecond) formatting = Replace(formatting, "%S", CInt(dateSecond)) formatting = Replace(formatting, "%L", WeekDay(unUDate)) formatting = Replace(formatting, "%D", Left(WeekDayName(WeekDay(unUDate)), 3)) formatting = Replace(formatting, "%l", WeekDayName(WeekDay(unUDate))) formatting = Replace(formatting, "%U", intTimeStamp) formatting = Replace(formatting, "11%O", "11th") formatting = Replace(formatting, "1%O", "1st") formatting = Replace(formatting, "12%O", "12th") formatting = Replace(formatting, "2%O", "2nd") formatting = Replace(formatting, "13%O", "13th") formatting = Replace(formatting, "3%O", "3rd") formatting = Replace(formatting, "%O", "th") formatDate = formatting End Function %> <% '-------------------------------------------------------------------------- ' Prints out the values of an array for debugging purposes '-------------------------------------------------------------------------- Sub print_r(ByVal array_value, depth) dim iCnt If IsArray(array_value) Then Response.Write ("Array") Response.Write (vbCrLf) If depth > 0 Then Response.Write (Space(4 * depth)) End If Response.Write ("(") Response.Write (vbCrLf) For iCnt = LBound(array_value) To UBound(array_value) Response.Write (Space(4 * (depth + 1))) Response.Write ("[") Response.Write (iCnt) Response.Write ("] => ") If IsArray(array_value(iCnt)) Then Call print_r(array_value(iCnt), depth + 2) Else Response.Write (array_value(iCnt)) Response.Write (vbCrLf) End If Next If depth > 0 Then Response.Write (Space(4 * depth)) End If Response.Write (")") Response.Write (vbCrLf) Response.Write (vbCrLf) End If End Sub '-------------------------------------------------------------------------- ' Prints out the values of a variable for debugging purposes '-------------------------------------------------------------------------- Sub var_dump(ByRef variable) dim iCnt, variable_type, variable_name variable_type = VarType(variable) variable_name = TypeName(variable) Select Case variable_type 'vbEmpty Case 0: Response.Write (variable_name) 'vbNull Case 1: Response.Write (variable_name) 'vbInteger Case 2: Response.Write (variable_name) 'vbLong Case 3: Response.Write (variable_name) 'vbSingle Case 4: Response.Write (variable_name) 'vbDouble Case 5: Response.Write (variable_name) 'vbCurrency Case 6: Response.Write (variable_name) 'vbString Case 7: Response.Write (variable_name) 'vbObject Case 8: Response.Write ("vbString") Case 9: Response.Write ("vbObject") Case 10: Response.Write ("vbError") Case 11: Response.Write ("vbBoolean") Case 12: Response.Write ("vbVariant") Case 13: Response.Write ("vbDataObject") Case 17: Response.Write ("vbByte") Case 8192, 8204, 8209: Response.Write ("vbArray") End Select End Sub %> <% '-------------------------------------------------------------------------- ' Error handling class '-------------------------------------------------------------------------- On Error Resume Next Class Errors '---------------------------------------------------------------------- ' Public Declarations '---------------------------------------------------------------------- ' Detailed errors 0 = off , 1 = on Public m_bDetailedError ' Create an error log file Public m_bLogErrors '---------------------------------------------------------------------- ' Private Declarations '---------------------------------------------------------------------- ' File location Private m_FilePath ' File name Private m_LogFile '---------------------------------------------------------------------- ' Private Functions '---------------------------------------------------------------------- ' Called when class is initialised Private Sub Class_Initialise() dim Err ' Turn detailed errors on m_bDetailedError = 1 ' Turn off error log m_bLogErrors = 0 ' Get location of site m_FilePath = Server.MapPath("/") ' Set file location and name m_LogFile = m_FilePath & "errors.log" End Sub Private Sub Class_Terminate() ' Called when class terminates m_bDetailedError = 0 m_bLogErrors = 0 End Sub '---------------------------------------------------------------------- ' Public Functions '---------------------------------------------------------------------- Public Function DetailedErrors(bDetail) ' Turn on/off detailed errors m_bDetailedError = bDetail End Function Public Function LogErrors(bLog) ' Turn on/off error logging m_bLogErrors = bLog End Function Public Function LogError() dim objFS, objTextFile ' Create File System Object and open error log for appending set objFS = Server.CreateObject("Scripting.FileSystemObject") set objTextFile = objFS.OpenTextFile(m_LogFile, 8, 1) ' Log the error objTextFile.WriteLine Date & ", " & Err.number & ", " & Err.Description ' Clean up objTextFile.Close set objTextFile = Nothing set objFS = Nothing End Function Public Function DisplayError() dim m_strStandardError ' Only display the error is there was one. If Err.Number <> 0 Then ' Set standard error message m_strStandardError = "

An error occurred while processing your request. Please try again.

" ' Check to see if they want detailed errors If m_bDetailedError = 1 Then m_strStandardError = m_strStandardError & "

Error " & Err.Number & " produced by " & Err.Source & ": " & Err.Description & "

" End If ' Check to see if error needs to be logged If m_bLogErrors = 1 Then LogError ' Display the error with drag and drop capabilities Response.Write (m_strStandardError) End If ' Clear the error Err.Clear End Function End Class On Error GoTo 0 %> <% '-------------------------------------------------------------------------- ' Disposes of any variable cleanly '-------------------------------------------------------------------------- Sub disposeVar(byRef anyVar) Select Case True Case IsObject(anyVar) Select Case LCase(TypeName(anyVar)) Case "recordset", "command", "stream", "connection" If anyVar.State <> 0 Then anyVar.Close End If Case "dictionary" anyVar.RemoveAll Case Else End Select Set anyVar = Nothing Case IsArray(anyVar) Erase anyVar Case Else End Select anyVar = Empty End Sub '-------------------------------------------------------------------------- ' Converts new lines to breaks '-------------------------------------------------------------------------- Function nl2br(byVal sText) nl2br = Replace(sText, vbNewLine, "
") End Function '-------------------------------------------------------------------------- ' Truncate URL '-------------------------------------------------------------------------- Function trunc_url(byVal link_in) Dim link_out: link_out = link_in link_out = Replace(link_out, "http://www.", "") link_out = Replace(link_out, "http://", "") If Right(link_out, 1) = "/" Then link_out = Left(link_out, Len(link_out) - 1) End If trunc_url = link_out End Function '-------------------------------------------------------------------------- ' Truncate string '-------------------------------------------------------------------------- Function trunc_str(byVal str_in) Dim str_out: str_out = str_in str_out = Replace(str_out, "&.", "&") If Len(str_out) > 15 Then str_out = Left(str_out, 15) & " ..." End If trunc_str = str_out End Function '-------------------------------------------------------------------------- ' Leading Zero '-------------------------------------------------------------------------- Function LeadingZero(byVal sX) Dim sY: sY = sX If IsNumeric(sY) Then If sY <= 9 AND sY >= 1 Then sY = "0" & sY End If LeadingZero = sY End Function '-------------------------------------------------------------------------- ' SQLise strings '-------------------------------------------------------------------------- Function SQLise(byVal sText) Dim sChr sChr = sText If sChr <> "" Then sChr = Replace(sChr, "'", "''") End If SQLise = sChr End Function '-------------------------------------------------------------------------- ' Tab '-------------------------------------------------------------------------- Function t(ByVal x) If IsNumeric(x) Then t = String(x, vbTab) End If End Function '-------------------------------------------------------------------------- ' Check and display messages '-------------------------------------------------------------------------- Sub checkMsgs(str_msg, msg) If NOT IsNull(msg) AND msg <> "" Then Response.Write (t(1)): Response.Write ("
"): Response.Write (vbCrLf) Response.Write (t(1)): Response.Write ("

") Select Case msg Case "add" Response.Write (str_msg): Response.Write (" added successfully") Case "upd" Response.Write (str_msg): Response.Write (" updated successfully") Case "del" Response.Write (str_msg): Response.Write (" deleted successfully") End Select Response.Write ("

"): Response.Write (vbCrLf) session("msg") = "" End If End Sub '-------------------------------------------------------------------------- ' Check and display error messages '-------------------------------------------------------------------------- Sub checkErrs() Dim err_num: err_num = Session("err") session("err") = "" If NOT IsNull(err_num) AND err_num <> "" Then Response.Write (t(1)): Response.Write ("
"): Response.Write (vbCrLf) Response.Write (t(1)): Response.Write ("

") Select Case err_num Case "000001": Response.Write ("Unable to connect to the database host or datasource") Case "000002": Response.Write ("The database record you wished to manipulate could not be found") Case "000003": Response.Write ("An error occurred during the update process") Case "000004": Response.Write ("An error occurred during the delete process") Case "000005": Response.Write ("Invalid record selection") Case "000007": Response.Write ("An error occurred during the insert process") Case "000008": Response.Write ("Invalid email address supplied") Case "000009": Response.Write ("If you remove this record, your site's administration will no longer function as expected") Case "000010": Response.Write ("Record insertion denied to avoid creating a duplicate entry") End Select Response.Write ("

"): Response.Write (vbCrLf) err_num = "" End If End Sub '-------------------------------------------------------------------------- ' Set error message and redirect '-------------------------------------------------------------------------- Sub throw_error(err_num, redirect_url) Session("err") = err_num Response.Redirect(redirect_url) End Sub '-------------------------------------------------------------------------- ' Set confirmation message and redirect '-------------------------------------------------------------------------- Sub confirm_action(str_msg, redirect_url) Session("msg") = str_msg Response.Redirect (redirect_url) End Sub '-------------------------------------------------------------------------- ' Display form errors '-------------------------------------------------------------------------- Sub output_errors(error_msgs) Response.Write ("
Form errors:

"): Response.Write (vbCrLf) Response.Write (error_msgs) Response.Write ("
"): Response.Write (vbCrLf) Response.Write ("Please correct the abovementioned errors before resubmitting this form
"): Response.Write (vbCrLf) error_msgs = "" End Sub '-------------------------------------------------------------------------- ' Get Random Number '-------------------------------------------------------------------------- Function RandNum(byVal intHighestNumber) Dim lowerBound, upperBound, randomIndex Randomize() lowerBound = 0 upperBound = intHighestNumber randomIndex = Int((upperBound - lowerBound + 1) * Rnd + lowerBound) RandNum = randomIndex End Function '-------------------------------------------------------------------------- ' Set Yes/No flag status '-------------------------------------------------------------------------- ' Broken, need to make a fixed version that'll work for SQL ' Server AND MS Access '-------------------------------------------------------------------------- Function setFlag(byVal sX) Select Case sX Case 1 setFlag = 1 Case 0 setFlag = 0 Case True setFlag = 1 Case False setFlag = 0 Case Else setFlag = 0 End Select End Function '-------------------------------------------------------------------------- ' Check to see if a number is Odd '-------------------------------------------------------------------------- Function IsOdd(byVal iInt) Dim nRes: nRes = iInt Mod 2 If nRes = 0 Then IsOdd = False ElseIf nRes = 1 Then IsOdd = True End If End Function '-------------------------------------------------------------------------- ' Make a serial '-------------------------------------------------------------------------- Function RandomNumber(byVal intHighestNumber) Randomize RandomNumber = Int(Rnd * intHighestNumber) + 1 End Function '-------------------------------------------------------------------------- ' Sanitise strings '-------------------------------------------------------------------------- Function Sanitise(byVal sText) Dim sChr, i If NOT IsNumeric(sText) Then For i = 1 To Len(sText) sChr = Mid(sText, i, 1) If sChr = "'" Then sChr = "" If sChr = "<" Then sChr = "" If sChr = ">" Then sChr = "" If sChr = """" Then sChr = "" If sChr = "%" Then sChr = "" If sChr = ";" Then sChr = "" If sChr = ")" Then sChr = "" If sChr = "(" Then sChr = "" If sChr = "&" Then sChr = "" If sChr = "+" Then sChr = "" Sanitise = Sanitise & sChr Next Else Sanitise = strText End If End Function '-------------------------------------------------------------------------- ' Returns alphanumeric string '-------------------------------------------------------------------------- Function alphanum(byVal sText) Dim sChr, i If NOT IsNumeric(sText) Then For i = 1 To Len(sText) sChr = Mid(sText, i, 1) If IsNumeric(sChr) Then alphanum = alphanum & sChr Else If sChr = " " OR (Asc(LCase(sChr)) <= 122 AND Asc(LCase(sChr)) >= 97) Then alphanum = alphanum & sChr End If End If Next Else alphanum = sText End If End Function '-------------------------------------------------------------------------- ' Ensure string is really numeric '-------------------------------------------------------------------------- Function is_numeric(byVal sText) Dim iCnt, sChr is_numeric = True If IsNull(sText) OR sText = "" Then is_numeric = False Exit Function End If If sText = "" Then is_numeric = False Exit Function End If For iCnt = 1 To Len(sText) sChr = Mid(sText, iCnt, 1) If Asc(sChr) < 48 OR Asc(sChr) > 57 Then is_numeric = False Exit For End If Next End Function '-------------------------------------------------------------------------- ' Checks for a valid phone number '-------------------------------------------------------------------------- Function is_telephonic(byVal sText) Dim iCnt, jCnt, sChr, sAllowed, blnValid sAllowed = "0123456789+()- " blnValid = True For iCnt = 1 To Len(sText) For jCnt = 1 To Len(sAllowed) sChr = Mid(sText, iCnt, 1) If (sChr = Mid(sAllowed, jCnt, 1)) Then Exit For End If If jCnt = Len(sAllowed) Then blnValid = False Exit For End If Next Next If NOT blnValid Then is_telephonic = False Else is_telephonic = True End If End Function '-------------------------------------------------------------------------- ' Simple sanitising of SQL strings '-------------------------------------------------------------------------- Function SimpleSanitise(sText) Dim sChr, i For i = 1 To Len(sText) sChr = Mid(sText, i, 1) If (sChr = "'") Then sChr = "`" End If SimpleSanitise = SimpleSanitise & sChr Next End Function '-------------------------------------------------------------------------- ' Returns true if e-mail address is valid, false if not '-------------------------------------------------------------------------- Function validateEmail(byVal sEmailAddress) Dim RegExObj, ExpressionMatch Set RegExObj = New RegExp With RegExObj .Pattern = "^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$" .IgnoreCase = True .Global = True End With ExpressionMatch = RegExObj.Test(sEmailAddress) If ExpressionMatch Then validateEmail = True Else validateEmail = False End If Set RegExObj = Nothing End Function '-------------------------------------------------------------------------- ' Obtain specific URL Parameter from URL string '-------------------------------------------------------------------------- Function getParam(ParamName) Dim Param1 If Request.QueryString(ParamName).Count > 0 Then Param1 = Request.QueryString(ParamName) ElseIf Request.Form(ParamName).Count > 0 Then Param1 = Request.Form(ParamName) Else Param1 = "" End If If Param1 = "" Then getParam = Empty Else getParam = Trim(Param1) End If End Function '-------------------------------------------------------------------------- ' Convert specific characters which break validation '-------------------------------------------------------------------------- Function xhtml(byVal sX) If sX <> "" OR sX <> " " Then xhtml = Replace(sX, "&", "&") Else xhtml = sX End If End Function '-------------------------------------------------------------------------- ' HTML encode function '-------------------------------------------------------------------------- Function encode(byVal sX) Dim sY If NOT IsNull(sX) Then If sX <> "" OR sX <> " " Then sY = Server.HTMLEncode(sX) sy = Replace(sY, "'","''") sY = Replace(sY, vbCrLf, "
") encode = sY End If Else encode = sX End If End Function '-------------------------------------------------------------------------- ' HTML decode function '-------------------------------------------------------------------------- Function decode(byVal sX) Dim sY If NOT IsNull(sX) Then If sX <> "" OR sX <> " " Then sY = Replace(sX, "<", "<") sY = Replace(sX, ">", ">") sY = Replace(sX, "
", vbCrLf) decode = sY End If Else decode = sX End If End Function '-------------------------------------------------------------------------- ' URL encode function '-------------------------------------------------------------------------- Function EncodeURL(x) If x <> "" AND NOT IsNull(x) Then EncodeURL = Server.URLEncode(x) End Function '-------------------------------------------------------------------------- ' Remove spaces '-------------------------------------------------------------------------- Function remove_spaces(file) Dim fname: fname = file If fname <> "" Then fname = Replace(fname, " ", "_") End If remove_spaces = fname End Function %> Terms & Conditions | Interexcel

 

Terms & Conditions


  1. Submitting this electronic application will serve as a valid and binding contract between the Applicant named on the electronic form and Interexcel, after completion thereof by the applicant and receipt hereof by Interexcel.
  2. Notwithstanding anything to the contrary, all services provided herein will be subject to Interexcel's Internet Services Agreement which follows this agreement, contents of which the applicant, by submission of this electronic application form, certifies having read, understood and agreed to.
  3. The services will be provided by Interexcel, with effect from the first day of the calendar month during which the first payment by debit order in terms hereof is effected.
  4. Payment for services will be made monthly in advance on the first day of the month, by debit order, for purposes of which the authorisation for payment by debit order hereafter is completed and submitted to Interexcel as part of this application.
  5. Interexcel reserves the right to, without notice, suspend all services if payment in terms of paragraph 4 hereof is not duly effected on due date thereof, and to terminate this agreement forthwith and without notice if such payment is not effected on or before the next payment in terms of this application becomes due and payable, and/or if such payment is not also duly made on due date thereof.
  6. Subject to the provisions hereof and Interexcels Internet Service Agreement referred to in paragraph 2 hereof, the services will be provided for a 12 (twelve) month period, whereafter this application will automatically be renewed unless terminated by either party in writing by giving 1 (one) calendar months notice.
  7. Interexcel hereby excludes liability for any reason whatsoever arising from the provision of the services in terms of this application or otherwise any warranties or representations hereto other than specified in Interexcels Internet Service Agreement.