<% Const SITE_NAME = "Sound Venture Productions" Const SITE_EMAIL = "maria@soundventure.com" Const SITE_CC_EMAIL = "info@soundventure.com" Const SITE_CC2_EMAIL = "office@soundventure.com" 'Const SITE_EMAIL = "denis@bayteksystems.com" 'Const SITE_CC_EMAIL = "dtessier98@hotmail.com" 'Const SITE_CC2_EMAIL = "dtessier98@hotmail.com" Const SITE_URL = "http://www.soundventure.com/onlinestore/" Const PAYMENT_URL = "https://www.beanstream.com/scripts/payment/payment.asp" Const CMS_USR = "admin" Const CMS_PWD = "tsv001" Const DATABASE_NAME = "tsv.mdb" Const DATABASE_USERNAME = "" Const DATABASE_PASSWORD = "" Const cSESSION_TIME = 1 Const REQUIRED_TXT = "*" Const PRODUCT_IMAGE_PATH = "/onlinestore/images/products/" Const VIDEO_IMAGE_PATH = "/onlinestore/images/videos/" Const cPRODUCT_ITEMS_PER_PAGE = 4 Const cVIDEO_ITEMS_PER_PAGE = 4 Const cFORMAT_LIST = "" Const cLANGUAGE_LIST = "" Const cSIZE_LIST = "" province_list="" valid_ext = array(".gif", ".jpg", ".jpeg", ".png", ".GIF", ".JPG", ".JPEG", ".PNG") '======================================================================= ' ' GENERIC FUNCTIONS ' '======================================================================= Function IsObjectInstalled(objName) On Error Resume Next Set tmpObj = Server.CreateObject(objName) If Err.Number = 0 Then IsObjectInstalled = True Set tmpObj = Nothing Else IsObjectInstalled = False End If On Error Goto 0 End Function Function BuiltList(arrList, numOfDimension, includeEmptyRow) Dim x numOfItems = UBound(arrList, numOfDimension) If includeEmptyRow Then BuiltList = "" If numOfDimension = 1 Then For x=0 To numOfItems BuiltList = BuiltList & "" Next Else For x=0 To numOfItems BuiltList = BuiltList & "" Next End If End Function Function getUniqueName() Dim d d = Now() getUniqueName=Year(d) & Month(d) & Day(d) & Hour(d) & Minute(d) & Second(d) End Function Sub myError(msg) Set DB = Nothing Response.Write "

Error

" & msg & "

" _ & "Back" Response.End End Sub Function GetRandomPassword(intLength) Randomize() intPasswordLength = 0 strCurrentPassword = "" do while intPasswordLength < intLength chrCurrentLetter = Int((42 * Rnd()) + 48) if chrCurrentLetter < 57 or chrCurrentLetter > 65 then strCurrentPassword = strCurrentPassword & Chr(chrCurrentLetter) intPasswordLength = intPasswordLength + 1 end if loop GetRandomPassword = strCurrentPassword End Function Sub SendEmail(strSender, strSubject, strContent, recipientName, recipientEmail, AttachmentFile) Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "smtp.thesmarterway.com" Mail.username="smtp@thesmarterway.com" Mail.password="smtp" Mail.From = strSender Mail.AddAddress recipientEmail, recipientName If Trim("" & AttachmentFile) <> "" Then Mail.AddAttachment AttachmentFile Mail.Subject = strSubject Mail.Body = strContent Mail.IsHTML = True strErr = "" bSuccess = False On Error Resume Next ' catch errors Mail.Send ' send message If Err <> 0 Then ' error occurred strErr = Err.Description Response.Write "

Error

" & strErr & "

" _ & "Back" Response.End Else bSuccess = True End If Set Mail = Nothing If Trim("" & AttachmentFile) <> "" Then Set FileSys = New clsFileSystem FileSys.DeleteFile(AttachmentFile) Set FileSys = Nothing End If End Sub Function ResizeImg(strImgPath,intNewHeight) Set jpeg = Server.CreateObject("Persits.Jpeg") jpeg.Open(Server.MapPath(LISTING_IMAGE_PATH & strImgPath)) If jpeg.Height > intNewHeight Then jpeg.Height = intNewHeight jpeg.Width = jpeg.OriginalWidth * jpeg.Height / jpeg.OriginalHeight End If If UCase(Right(strImgPath, 3)) <> "JPG" Then strOldPath = strImgPath tmp=Right(fileName,Len(fileName)-InStrRev(fileName,".")) strImgPath = Replace(strImgPath,tmp,"") & "jpg" End If jpeg.Save LCase(Server.MapPath(LISTING_IMAGE_PATH & strImgPath)) Set jpeg = Nothing If strOldPath <> "" Then Set FileSys = New clsFileSystem FileSys.DeleteFile(LISTING_IMAGE_PATH & strOldPath) Set FileSys = Nothing End If ResizeImg=strImgPath End Function '==================== ' ' Specific Functions ' '==================== Function GetCategoryList() GetCategoryList = "" strQuery = "SELECT id, name FROM tsv_categories ORDER BY ordering ASC, name ASC" galleryNumOf = DB.RunQuery(strQuery) -1 If galleryNumOf > -1 Then GalleryData = DB.GetLastResults() For x = 0 to galleryNumOf GetCategoryList = GetCategoryList & "" Next End If End Function Function getCategoryLinks() intCategoryID = CInt(Request.QueryString("category")) strQuery = "SELECT id, name FROM tsv_categories ORDER BY ordering ASC, name ASC" numOf = DB.RunQuery(strQuery) -1 If numOf > -1 Then LinkData = DB.GetLastResults getCategoryLinks = getCategoryLinks & "" For x = 0 To numOf If intCategoryID = LinkData(0,x) Then strBackground = " bgcolor=""#FCF4F6"" " Else strBackground = " bgcolor=""#FFFFFF"" " End If getCategoryLinks = getCategoryLinks & _ "" & _ " -" & _ " " & LinkData(1,x) & "" & _ "" Next getCategoryLinks = getCategoryLinks & "" End If End Function Function getPriceLink() strURL = getURL() If Request.Cookies("tsv")("price_type") = "theatrical" Then getPriceLink = "Click here for Personal Use Prices" Else getPriceLink = "Click here for Non-theatrical Use Prices" End If End Function Function getCategoryName(intCategoryID) strQuery = "SELECT name FROM tsv_categories WHERE id=" & intCategoryID numOf = DB.RunQuery(strQuery) -1 If numOf > -1 Then getCategoryName = DB.GetField("name") End If End Function Function getURL() strURL = Request.ServerVariables("SCRIPT_NAME") If Request.ServerVariables("QUERY_STRING") <> "" Then strURL = strURL & "?" & Request.ServerVariables("QUERY_STRING") End If getURL = strURL End Function Function BuildOptions(ByVal strValues, ByVal intOptionNumber, ByRef strField, ByRef strFieldTitle) Dim arrValues Dim intNumOfValues Dim strValueName arrValues = Split(strValues, "|") intNumOfValues = UBound(arrValues) BuildOptions = "" & _ "" & _ "" End Function Function GetUPSCost() Dim xmlRequest Dim sngWeight xmlRequest = "" & _ "" & vbCrLf & _ "" & vbCrLf & _ vbTab & "7C0B38A8962417F2" & vbCrLf & _ vbTab & "sound venture" & vbCrLf & _ vbTab & "SVP126" & vbCrLf & _ "" & vbCrLf xmlRequest = xmlRequest & _ "" & vbCrLf & _ "" & vbCrLf & _ vbTab & "" & vbCrLf & _ vbTab & vbTab & "Rate" & vbCrLf & _ vbTab & "" & vbCrLf & _ vbTab & "" & vbCrLf & _ vbTab & vbTab & "06" & vbCrLf & _ vbTab & "" & vbCrLf & _ vbTab & "" & vbCrLf & _ vbTab & vbTab & "03" & vbCrLf & _ vbTab & "" & vbCrLf & _ vbTab & "" & vbCrLf & _ vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & "3R8W55" & vbCrLf & _ vbTab & vbTab & vbTab & "
" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "K1N5T5" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "CA" & vbCrLf & _ vbTab & vbTab & vbTab & "
" & vbCrLf & _ vbTab & vbTab & "
" & vbCrLf & _ vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & "
" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & Request.Form("shipping_postal_code") & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & Request.Form("shipping_country") & "" & vbCrLf & _ vbTab & vbTab & vbTab & "
" & vbCrLf & _ vbTab & vbTab & "
" & vbCrLf & _ vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & "11" & vbCrLf & _ vbTab & vbTab & "" & vbCrLf For x = 0 To NUM_OF_ITEMS sngWeight = 0: sngWeight = Round(MY_CART(cProductWeight,x) * 0.001, 1) 'Response.Write "Weight: " & sngWeight & "
Lenght: " & MY_CART(cProductLength,x) & "
Width: " & MY_CART(cProductWidth,x) & "
Height: " & MY_CART(cProductHeight,x) For y = 1 To MY_CART(cProductQuantity,x) xmlRequest = xmlRequest & _ vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "02" & vbCrLf & _ vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & vbTab & "KGS" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & sngWeight & "" & vbCrLf & _ vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & vbTab & "CM" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & MY_CART(cProductLength,x) & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & MY_CART(cProductWidth,x) & "" & vbCrLf & _ vbTab & vbTab & vbTab & vbTab & "" & MY_CART(cProductHeight,x) & "" & vbCrLf & _ vbTab & vbTab & vbTab & "" & vbCrLf & _ vbTab & vbTab & "" & vbCrLf Next Next xmlRequest = xmlRequest & _ vbTab & "
" & vbCrLf & _ "
" & vbCrLf Dim objXmlDOM Set objXmlDOM = Server.CreateObject("Microsoft.XMLDOM") 'Response.Write SendXMLRequest ("https://wwwcie.ups.com/ups.app/xml/Rate", xmlRequest) 'Response.Write xmlRequest 'Response.End objXmlDOM.loadXML SendXMLRequest ("https://www.ups.com/ups.app/xml/Rate", xmlRequest) trans_result=objXmlDOM.getElementsByTagName("ResponseStatusDescription").item(0).text If LCase(trans_result)<>"success" Then Set objXmlDOM = Nothing Call myError("Error getting the shipping cost at UPS.") End If GetUPSCost = objXmlDOM.getElementsByTagName("MonetaryValue").item(2).text Set objXmlDOM = Nothing End Function Function SendXMLRequest(ByVal sURL, ByVal sRequestXML) ' sends xml and gets response back Dim oHTTP 'Set oHTTP = Server.CreateObject("Microsoft.XMLHTTP") Set oHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP") oHTTP.open "POST", sURL, false oHTTP.setRequestHeader "Content-Type", "text/xml" On Error Resume Next oHTTP.send(sRequestXML) If Err Then strError = "The shipping rate server is temporarily out of service.

Sorry for the inconvenience, please try again soon.

" Else SendXMLRequest = oHTTP.responseText End If On Error Goto 0 Set oHTTP = Nothing End Function %>