%
Session.LCID = 1033
Sub SubAddBanner
Dim ErrorFlag : ErrorFlag = "False"
If Trim(Request("bName")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bName") = "
missing."
End If
If Request("bAdvertiserID") = "0" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bAdvertiserID") = "
missing."
End If
If Request("bZoneID") = "0" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bZoneID") = "
missing."
End If
If Trim(Request("bTargetUrl")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bTargetUrl") = "
missing!"
End If
If Trim(Request("BannerType")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_BannerType") = "
missing!"
End If
IF Trim(Request("BannerType")) = "TypeTextLinkAd" THEN
If Trim(Request("bTextLinkAd")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bTextLinkAd") = "
missing!"
End If
ELSEIF Trim(Request("BannerType")) = "TypeImageAd" THEN
If Trim(Request("bImageAdUrl")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bImageAdUrl") = "
missing!"
End If
If Trim(Request("bImageAdWidth")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bImageAdWidth") = "
missing!"
End If
If Trim(Request("bImageAdHeight")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bImageAdHeight") = "
missing!"
End If
END IF
IF Request("bPaymentType") <> "0" THEN
If Request("bUnitCost") = "0" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bUnitCost") = "
missing!"
End If
END IF
Dim StartDay : StartDay = Request("StartDay")
Dim StartMonth : StartMonth = Request("StartMonth")
Dim StartYear : StartYear = Request("StartYear")
Dim getStartDate
If DATABASE = "MySQL" Then
'getStartDate = StartYear & "-" & StartMonth & "-" & StartDay & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getStartDate = StartYear & "-" & StartMonth & "-" & StartDay
getStartDate = getStartDate
Else
'getStartDate = StartMonth & "/" & StartDay & "/" & StartYear & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getStartDate = StartMonth & "/" & StartDay & "/" & StartYear
getStartDate = cDate(getStartDate)
End If
Dim bStartDate : bStartDate = getStartDate
Dim EndDay : EndDay = Request("EndDay")
Dim EndMonth : EndMonth = Request("EndMonth")
Dim EndYear : EndYear = Request("EndYear")
Dim getEndDate
If DATABASE = "MySQL" Then
'getEndDate = EndYear & "-" & EndMonth & "-" & EndDay & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getEndDate = EndYear & "-" & EndMonth & "-" & EndDay
getEndDate = getEndDate
Else
'getEndDate = EndMonth & "/" & EndDay & "/" & EndYear & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getEndDate = EndMonth & "/" & EndDay & "/" & EndYear
getEndDate = cDate(getEndDate)
End If
Dim bEndDate : bEndDate = getEndDate
checkStartDate = StartYear & "-" & StartMonth & "-" & StartDay
checkStartDate = cDate(checkStartDate)
checkEndDate = EndMonth & "/" & EndDay & "/" & EndYear
checkEndDate = cDate(getEndDate)
If checkEndDate < checkStartDate then
ErrorFlag = "True"
Session("JBSX_Form_Fld_EndDate") = "
Error..End date is before Start date!"
ElseIf checkEndDate < Date() then
ErrorFlag = "True"
Session("JBSX_Form_Fld_EndDate") = "
Error..End date is before date today!"
End If
If ErrorFlag = "False" Then
Dim bIsImageAd
Dim str_bImageAdUrl, str_bImageAdAlt, str_bImageAdWidth, str_bImageAdHeight, str_bImageAdBorder
Dim str_bTextLinkAd
If Request("BannerType") = "TypeImageAd" Then
bIsImageAd = "True"
str_bTextLinkAd = ""
str_bImageAdUrl = ChkString(Request("bImageAdUrl"))
str_bImageAdAlt = ChkString(Request("bImageAdAlt"))
str_bImageAdWidth = ChkString(Request("bImageAdWidth"))
str_bImageAdHeight = ChkString(Request("bImageAdHeight"))
str_bImageAdBorder = ChkString(Request("bImageAdBorder"))
Else
bIsImageAd = "False"
str_bTextLinkAd = ChkString(Request("bTextLinkAd"))
str_bImageAdUrl = ""
str_bImageAdAlt = ""
str_bImageAdWidth = ""
str_bImageAdHeight = ""
str_bImageAdBorder = ""
End If
Dim int_bUnitCost, int_bQuantityPurchased
int_bUnitCost = Request("bUnitCost")
int_bQuantityPurchased = Request("bQuantityPurchased")
If Request("bPaymentType") = "0" THEN
int_bUnitCost = 0
int_bQuantityPurchased = 0
End If
If ((Request("bPaymentType") = "1") Or Request("bPaymentType") = "2") THEN
int_bUnitCost = int_bUnitCost
int_bQuantityPurchased = int_bQuantityPurchased
End If
If Request("bPaymentType") = "3" THEN
int_bUnitCost = int_bUnitCost
int_bQuantityPurchased = 0
End If
If int_bUnitCost = "" Then
int_bUnitCost = 0
Else
int_bUnitCost = int_bUnitCost
End If
If int_bQuantityPurchased = "" then
int_bQuantityPurchased = 0
Else
int_bQuantityPurchased = int_bQuantityPurchased
End If
Dim strStatus
If bStartDate > convertDate(DATABASE) then
strStatus = "Hold"
Else
strStatus = Request("bStatus")
End If
strSQL = "INSERT INTO JBS_Banners (bZoneID, bAdvertiserID, bTargetUrl, bIsImageAd, bName, bStartDate, bEndDate ,bStatus ,bWeight, bTargetWindow, bTextLinkAd, bImageAdUrl, bImageAdAlt, bImageAdWidth, bImageAdHeight, bImageAdBorder, bPaymentType, bUnitCost, bQuantityPurchased, bAddedByUserID, bAddedByUserDate, bAdditionalText) values ("
strSQL = strSQL & Request("bZoneID") & ", "
strSQL = strSQL & Request("bAdvertiserID") & ", '"
strSQL = strSQL & ChkLink(Request("bTargetUrl")) & "', '"
strSQL = strSQL & bIsImageAd & "', '"
strSQL = strSQL & Request("bName") & "', " & dbDateSign(DATABASE)
strSQL = strSQL & bStartDate & dbDateSign(DATABASE) & ", " & dbDateSign(DATABASE)
strSQL = strSQL & bEndDate & dbDateSign(DATABASE) & ", '"
strSQL = strSQL & strStatus & "', "
strSQL = strSQL & Request("bWeight") & ", '"
strSQL = strSQL & Request("bTargetWindow") & "', '"
strSQL = strSQL & str_bTextLinkAd & "', '"
strSQL = strSQL & str_bImageAdUrl & "', '"
strSQL = strSQL & str_bImageAdAlt & "', '"
strSQL = strSQL & str_bImageAdWidth & "', '"
strSQL = strSQL & str_bImageAdHeight & "', '"
strSQL = strSQL & str_bImageAdBorder & "', "
strSQL = strSQL & Request("bPaymentType") & ", "
strSQL = strSQL & int_bUnitCost & ", "
strSQL = strSQL & int_bQuantityPurchased & ", "
strSQL = strSQL & Session("JBSX_UserID") & ", " & dbDateSign(DATABASE)
strSQL = strSQL & convertDate(DATABASE) & dbDateSign(DATABASE) & ", '"
strSQL = strSQL & Request("bAdditionalText") & "')"
Conn.Execute (strSQL)
Session("JBSX_Update") = "True"
Else
Session("JBSX_Update") = "False"
Session("JBSX_mem_Form_Fld_bName") = Request("bName")
Session("JBSX_mem_Form_Fld_bZoneID") = Request("bZoneID")
Session("JBSX_mem_Form_Fld_bAdvertiserID") = Request("bAdvertiserID")
Session("JBSX_mem_Form_Fld_bTargetUrl") = Request("bTargetUrl")
Session("JBSX_mem_Form_Fld_BannerType") = Request("BannerType")
Session("JBSX_mem_Form_Fld_StartDay") = Request("StartDay")
Session("JBSX_mem_Form_Fld_StartMonth") = Request("StartMonth")
Session("JBSX_mem_Form_Fld_StartYear") = Request("StartYear")
Session("JBSX_mem_Form_Fld_EndDay") = Request("EndDay")
Session("JBSX_mem_Form_Fld_EndMonth") = Request("EndMonth")
Session("JBSX_mem_Form_Fld_EndYear") = Request("EndYear")
Session("JBSX_mem_Form_Fld_bStatus") = Request("bStatus")
Session("JBSX_mem_Form_Fld_bWeight") = Request("bWeight")
Session("JBSX_mem_Form_Fld_bTargetWindow") = Request("bTargetWindow")
Session("JBSX_mem_Form_Fld_bTextLinkAd") = Request("bTextLinkAd")
Session("JBSX_mem_Form_Fld_bImageAdUrl") = Request("bImageAdUrl")
Session("JBSX_mem_Form_Fld_bImageAdAlt") = Request("bImageAdAlt")
Session("JBSX_mem_Form_Fld_bImageAdWidth") = Request("bImageAdWidth")
Session("JBSX_mem_Form_Fld_bImageAdHeight") = Request("bImageAdHeight")
Session("JBSX_mem_Form_Fld_bImageAdBorder") = Request("bImageAdBorder")
Session("JBSX_mem_Form_Fld_bPaymentType") = Request("bPaymentType")
Session("JBSX_mem_Form_Fld_bUnitCost") = Request("bUnitCost")
Session("JBSX_mem_Form_Fld_bQuantityPurchased") = Request("bQuantityPurchased")
Session("JBSX_mem_Form_Fld_bTimeRange") = Request("bTimeRange")
Session("JBSX_mem_Form_Fld_bAdditionalText") = Request("bAdditionalText")
End If
Call returnLCID()
strRedirectUrl = "addBanner.asp"
Response.Redirect (strRedirectUrl)
End Sub
Sub SubEditBanner
Dim ErrorFlag : ErrorFlag = "False"
If Trim(Request("bName")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bName") = "
missing."
End If
If Request("bAdvertiserID") = "0" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bAdvertiserID") = "
missing."
End If
If Request("bZoneID") = "0" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bZoneID") = "
missing."
End If
If Trim(Request("bTargetUrl")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bTargetUrl") = "
missing!"
End If
If Trim(Request("BannerType")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_BannerType") = "
missing!"
End If
IF Trim(Request("BannerType")) = "TypeTextLinkAd" THEN
If Trim(Request("bTextLinkAd")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bTextLinkAd") = "
missing!"
End If
ELSEIF Trim(Request("BannerType")) = "TypeImageAd" THEN
If Trim(Request("bImageAdUrl")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bImageAdUrl") = "
missing!"
End If
If Trim(Request("bImageAdWidth")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bImageAdWidth") = "
missing!"
End If
If Trim(Request("bImageAdHeight")) = "" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bImageAdHeight") = "
missing!"
End If
END IF
IF Request("bPaymentType") <> "0" THEN
If Request("bUnitCost") = "0" Then
ErrorFlag = "True"
Session("JBSX_Form_Fld_bUnitCost") = "
missing!"
End If
END IF
Dim StartDay : StartDay = Request("StartDay")
Dim StartMonth : StartMonth = Request("StartMonth")
Dim StartYear : StartYear = Request("StartYear")
Dim getStartDate
If DATABASE = "MySQL" Then
'getStartDate = StartYear & "-" & StartMonth & "-" & StartDay & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getStartDate = StartYear & "-" & StartMonth & "-" & StartDay
getStartDate = getStartDate
Else
'getStartDate = StartMonth & "/" & StartDay & "/" & StartYear & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getStartDate = StartMonth & "/" & StartDay & "/" & StartYear
getStartDate = cDate(getStartDate)
End If
Dim bStartDate : bStartDate = getStartDate
Dim EndDay : EndDay = Request("EndDay")
Dim EndMonth : EndMonth = Request("EndMonth")
Dim EndYear : EndYear = Request("EndYear")
Dim getEndDate
If DATABASE = "MySQL" Then
'getEndDate = EndYear & "-" & EndMonth & "-" & EndDay & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getEndDate = EndYear & "-" & EndMonth & "-" & EndDay
getEndDate = getEndDate
Else
'getEndDate = EndMonth & "/" & EndDay & "/" & EndYear & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
getEndDate = EndMonth & "/" & EndDay & "/" & EndYear
getEndDate = cDate(getEndDate)
End If
Dim bEndDate : bEndDate = getEndDate
checkStartDate = StartYear & "-" & StartMonth & "-" & StartDay
checkStartDate = cDate(checkStartDate)
checkEndDate = EndMonth & "/" & EndDay & "/" & EndYear
checkEndDate = cDate(getEndDate)
If checkEndDate < checkStartDate then
ErrorFlag = "True"
Session("JBSX_Form_Fld_EndDate") = "
Error..End date is before Start date!"
End If
If ErrorFlag = "False" Then
Dim bIsImageAd
Dim str_bImageAdUrl, str_bImageAdAlt, str_bImageAdWidth, str_bImageAdHeight, str_bImageAdBorder
Dim str_bTextLinkAd
If Request("BannerType") = "TypeImageAd" Then
bIsImageAd = "True"
str_bTextLinkAd = ""
str_bImageAdUrl = ChkString(Request("bImageAdUrl"))
str_bImageAdAlt = ChkString(Request("bImageAdAlt"))
str_bImageAdWidth = ChkString(Request("bImageAdWidth"))
str_bImageAdHeight = ChkString(Request("bImageAdHeight"))
str_bImageAdBorder = ChkString(Request("bImageAdBorder"))
Else
bIsImageAd = "False"
str_bTextLinkAd = ChkString(Request("bTextLinkAd"))
str_bImageAdUrl = ""
str_bImageAdAlt = ""
str_bImageAdWidth = ""
str_bImageAdHeight = ""
str_bImageAdBorder = ""
End If
Dim int_bUnitCost, int_bQuantityPurchased
int_bUnitCost = Request("bUnitCost")
int_bQuantityPurchased = Request("bQuantityPurchased")
If Request("bPaymentType") = "0" THEN
int_bUnitCost = 0
int_bQuantityPurchased = 0
End If
If ((Request("bPaymentType") = "1") Or Request("bPaymentType") = "2") THEN
int_bUnitCost = int_bUnitCost
int_bQuantityPurchased = int_bQuantityPurchased
End If
If Request("bPaymentType") = "3" THEN
int_bUnitCost = int_bUnitCost
int_bQuantityPurchased = 0
End If
If int_bUnitCost = "" Then
int_bUnitCost = 0
Else
int_bUnitCost = int_bUnitCost
End If
If int_bQuantityPurchased = "" then
int_bQuantityPurchased = 0
Else
int_bQuantityPurchased = int_bQuantityPurchased
End If
Dim strStatus
If Request("bStatus") <> "" Then
strStatus = Request("bStatus")
If bStartDate > convertDate(DATABASE) then
strStatus = "Hold"
End If
Else
If bEndDate > convertDate(DATABASE) then
strStatus = "Active"
Else
strStatus = "Expired"
End If
End If
strSQL = "UPDATE JBS_Banners SET "
strSQL = strSQL & "bZoneID = " & Request("bZoneID") & ", "
strSQL = strSQL & "bAdvertiserID = " & Request("bAdvertiserID") & ", "
strSQL = strSQL & "bTargetUrl = '" & ChkLink(Request("bTargetUrl")) & "', "
strSQL = strSQL & "bIsImageAd = '" & bIsImageAd & "', "
strSQL = strSQL & "bName = '" & Request("bName") & "', "
strSQL = strSQL & "bStartDate = " & dbDateSign(DATABASE) & bStartDate & dbDateSign(DATABASE) & ", "
strSQL = strSQL & "bEndDate = " & dbDateSign(DATABASE) & bEndDate & dbDateSign(DATABASE) & ", "
strSQL = strSQL & "bStatus = '" & strStatus & "', "
strSQL = strSQL & "bWeight = " & Request("bWeight") & ", "
strSQL = strSQL & "bTargetWindow = '" & Request("bTargetWindow") & "', "
strSQL = strSQL & "bTextLinkAd = '" & str_bTextLinkAd & "', "
strSQL = strSQL & "bImageAdUrl = '" & str_bImageAdUrl & "', "
strSQL = strSQL & "bImageAdAlt = '" & str_bImageAdAlt & "', "
strSQL = strSQL & "bImageAdWidth = '" & str_bImageAdWidth & "', "
strSQL = strSQL & "bImageAdHeight = '" & str_bImageAdHeight & "', "
strSQL = strSQL & "bImageAdBorder = '" & str_bImageAdBorder & "', "
strSQL = strSQL & "bPaymentType = " & Request("bPaymentType") & ", "
strSQL = strSQL & "bUnitCost = " & int_bUnitCost & ", "
strSQL = strSQL & "bQuantityPurchased = " & int_bQuantityPurchased & ", "
strSql = strSql & "bLastEditedByUserID = " & Session("JBSX_UserID") & ", "
strSql = strSql & "bLastEditedByUserDate = " & dbDateSign(DATABASE) & convertDate(DATABASE) & dbDateSign(DATABASE) & ", "
strSQL = strSQL & "bAdditionalText = '" & Request("bAdditionalText") & "' "
strSQL = strSQL & "WHERE BannerID = " & Request("BannerID")
Conn.Execute (strSQL)
Session("JBSX_Update") = "True"
Call SetBannerStatus(Request("BannerID"))
Else
Session("JBSX_Update") = "False"
Session("JBSX_mem_Form_Fld_bName") = Request("bName")
Session("JBSX_mem_Form_Fld_bZoneID") = Request("bZoneID")
Session("JBSX_mem_Form_Fld_bAdvertiserID") = Request("bAdvertiserID")
Session("JBSX_mem_Form_Fld_bTargetUrl") = Request("bTargetUrl")
Session("JBSX_mem_Form_Fld_BannerType") = Request("BannerType")
Session("JBSX_mem_Form_Fld_StartDay") = Request("StartDay")
Session("JBSX_mem_Form_Fld_StartMonth") = Request("StartMonth")
Session("JBSX_mem_Form_Fld_StartYear") = Request("StartYear")
Session("JBSX_mem_Form_Fld_EndDay") = Request("EndDay")
Session("JBSX_mem_Form_Fld_EndMonth") = Request("EndMonth")
Session("JBSX_mem_Form_Fld_EndYear") = Request("EndYear")
Session("JBSX_mem_Form_Fld_bStatus") = Request("bStatus")
Session("JBSX_mem_Form_Fld_bWeight") = Request("bWeight")
Session("JBSX_mem_Form_Fld_bTargetWindow") = Request("bTargetWindow")
Session("JBSX_mem_Form_Fld_bTextLinkAd") = Request("bTextLinkAd")
Session("JBSX_mem_Form_Fld_bImageAdUrl") = Request("bImageAdUrl")
Session("JBSX_mem_Form_Fld_bImageAdAlt") = Request("bImageAdAlt")
Session("JBSX_mem_Form_Fld_bImageAdWidth") = Request("bImageAdWidth")
Session("JBSX_mem_Form_Fld_bImageAdHeight") = Request("bImageAdHeight")
Session("JBSX_mem_Form_Fld_bImageAdBorder") = Request("bImageAdBorder")
Session("JBSX_mem_Form_Fld_bPaymentType") = Request("bPaymentType")
Session("JBSX_mem_Form_Fld_bUnitCost") = Request("bUnitCost")
Session("JBSX_mem_Form_Fld_bQuantityPurchased") = Request("bQuantityPurchased")
Session("JBSX_mem_Form_Fld_bTimeRange") = Request("bTimeRange")
Session("JBSX_mem_Form_Fld_bAdditionalText") = Request("bAdditionalText")
End If
Call returnLCID()
strRedirectUrl = "editBanner.asp?BannerID=" & Request("BannerID")
Response.Redirect (strRedirectUrl)
End Sub
Sub SubUpdateBannerStatus
strSQL = "UPDATE JBS_Banners SET bStatus = '" & Request("bStatus") & "', bLastEditedByUserID = " & Session("JBSX_UserID") & ", bLastEditedByUserDate = " & dbDateSign(DATABASE) & Date() & dbDateSign(DATABASE) & " WHERE BannerID = " & Request("BannerID")
Conn.Execute (strSQL)
If Request("Page") = "zone" Then
strRedirectUrl = Request("Page") & ".asp?zAction=" & Request("zAction") & "&ZoneID=" & Request("ZoneID")
ElseIf Request("Page") = "advertiser" Then
strRedirectUrl = Request("Page") & ".asp?aAction=" & Request("aAction") & "&AdvertiserID=" & Request("AdvertiserID")
Else
strRedirectUrl = Request("Page") & ".asp"
End If
Call returnLCID()
Response.Redirect (strRedirectUrl)
End Sub
Sub SubDeleteBanner
SQL = "Delete FROM JBS_Banners WHERE BannerID=" & Request("BannerID")
Conn.Execute(SQL)
Call returnLCID()
strRedirectUrl = Request("Page") & ".asp?AdvertiserID=" & Request("AdvertiserID") & "&ZoneID=" & Request("ZoneID")
Response.Redirect (strRedirectUrl)
End Sub
select case Request("Action")
case "AddBanner"
Call SubAddBanner
case "EditBanner"
Call SubEditBanner
case "DeleteBanner"
Call SubDeleteBanner
case "UpdateBannerStatus"
Call SubUpdateBannerStatus
End Select
%>