%
Function convertDate(Database)
Dim sDate
If Database = "MySQL" Then
sDate = Year(Now) & "-" & Month(Now) & "-" & Day(Now) & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
sDate = sDate
Else
sDate = Month(Now) &"/"& Day(Now) &"/"& Year(Now) & " " & Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
sDate = cDate(sDate)
End If
convertDate = sDate
End Function
Function dbDateSign(Database)
Dim Sign
If Database = "MSACCESS" Then
Sign = "#"
ElseIf Database = "MySQL" Then
Sign = "'"
Else
Sign = "'"
End If
dbDateSign = Sign
End Function
Function displayMenu(Str)
dim a
if instr(Str,"/files/") > 0 then
a = True
elseif instr(Str,"/upload/") > 0 then
a = True
else
a = False
end if
displayMenu = a
End Function
Function writePageNavigation(strOne,strTwo,strTree,strFour)
Response.Write "
"
Response.Write "
"
If Len(strOne) <> 0 then Response.Write " " & strOne End If
If Len(strTwo) <> 0 then Response.Write " » " & strTwo End If
If Len(strTree) <> 0 then Response.Write " » " & strTree End If
If Len(strFour) <> 0 then Response.Write " » " & strFour End If
Response.Write "
"
Response.Write "
"
End Function
Function UserIndentifier(strName, AdminOrAdvertiser)
Dim strID
IF AdminOrAdvertiser = "Admin" THEN
If Len(strName) <> 0 Then
strID = " " & Application(getLang() & "_strJBS_02110") & ": " & strName & " "
If Session("JBSX_uSuperAdmin") = "True" Then
strID = strID & " " & Application(getLang() & "_strJBS_02150") & ": " & Application(getLang() & "_strJBS_02190") & " "
Else
strID = strID & " " & Application(getLang() & "_strJBS_02150") & ": " & Application(getLang() & "_strJBS_02180") & " "
End If
strID = strID & " " & Application(getLang() & "_strJBS_00320") & ": " & Now()
UserIndentifier = strID
Else
UserIndentifier = ""
End If
ELSEIF AdminOrAdvertiser = "Advertiser" THEN
If Len(strName) <> 0 THEN
strID = " " & Application(getLang() & "_strJBS_02110") & ": " & strName & " "
strID = strID & " " & Application(getLang() & "_strJBS_02150") & ": " & Application(getLang() & "_strJBS_00430") & " "
strID = strID & " " & Application(getLang() & "_strJBS_00320") & ": " & Now()
UserIndentifier = strID
Else
UserIndentifier = ""
End If
END IF
End Function
Function formatLCID(myValue)
Session.LCID = 1033
formatLCID = myValue
End Function
Function returnLCID()
Session.LCID = Application("JBSX_sSettings_LanguageLCID")
End Function
function getLang()
Dim a
a = Session("JBSX_JBS_uLanguage")
if Len(a) = 0 Then
a = Request.Cookies("JBSX")("uLanguage")
end if
if Len(a) = 0 Then
a = Application("JBSX_sSettings_DefaultLanguage")
end if
getLang = a
end function
function getTemplate()
Dim t
t = Session("JBSX_JBS_uTemplate")
if Len(t) = 0 Then
t = Application("JBSX_sSettings_DefaultTemplate")
end if
if Len(t) = 0 Then
t = "JBS_Orginal"
end if
getTemplate = t
end function
Function MakePwd(intPwdLength)
Dim strLetter
Dim arrLetter
Dim t_Pwd
Dim i
Dim intLetter
Randomize
strLetter ="A,B,C,D,E,F,G,H,I,J,K,L,M,n,o,p,q,r,s,t,u,v,w,x,y,z," & _
"0,1,2,3,4,5,6,7,8,9,N,O,P,Q,R,S,T,U,V,W,X,Y,Z," & _
"a,b,c,d,e,f,g,h,i,j,k,l,m,"
arrLetter = Split(strLetter,",")
For i = 1 To intPwdLength
intLetter = CInt(RND * UBound(arrLetter))
t_Pwd = t_Pwd & arrLetter(intLetter)
Next
MakePwd = t_Pwd
End Function
Function DeleteOldStat(Database)
If Application("JBSX_sSettings_TrackBannerForDays") <> "0" then
'Dim DeleteFromDate : DeleteFromDate = formatLCID(Date()) - Application("JBSX_sSettings_TrackBannerForDays")
Dim DeleteFromDate, stDate
DeleteFromDate = DateAdd("d", -Application("JBSX_sSettings_TrackBannerForDays"), Date())
If Database = "MySQL" Then
stDate = Year(DeleteFromDate) & "-" & Month(DeleteFromDate) & "-" & Day(DeleteFromDate)
Else
stDate = Month(DeleteFromDate) &"/"& Day(DeleteFromDate) &"/"& Year(DeleteFromDate)
stDate = cDate(stDate)
End If
SQL = "DELETE FROM JBS_BannerStat WHERE sDate < " & dbDateSign(DATABASE) & stDate & dbDateSign(DATABASE) & " "
Conn.Execute(SQL)
End If
End Function
Function getAdminHistory(sUserID, sAdminDate)
Dim strAdminByAndDate
Dim sSQL, sRS
If IsNull(sUserID) Then
sUserID = 0
End If
IF Clng(sUserID) <> Clng(0) THEN
sSQL = "SELECT DISTINCT(uFullName) FROM JBS_Users WHERE UserID = " & sUserID
Set sRS = Conn.Execute(sSQL)
If Not sRS.EOF Then
strAdminByAndDate = sRS("uFullName") & " - " & sAdminDate & ""
Else
strAdminByAndDate = "User Name unknown (id:" & sUserID & ") - (" & sAdminDate & ")"
End If
sRS.Close : Set sRS = Nothing
ELSE
strAdminByAndDate = " - "
END IF
sSQL = ""
getAdminHistory = strAdminByAndDate
End Function
Function getPermission(IsUserSuperAdmin, UserSettingItem)
Dim Permission
IF IsUserSuperAdmin = "True" Then
Permission = "True"
ELSEIF IsUserSuperAdmin = "False" Then
if UserSettingItem = "True" then
Permission = "True"
else
Permission = "False"
end if
ELSE
Permission = "False"
END IF
getPermission = Permission
End Function
Function strUserAccount(SuperAdmin)
Dim Account
If SuperAdmin = "True" Then
'Account = "Super Admin"
Account = Application(getLang() & "_strJBS_02190")
Else
'Account = "Admin"
Account = Application(getLang() & "_strJBS_02180")
End If
strUserAccount = Account
End Function
Function SendMail(EmailComponent, RemoteHost, SenderAddress, SenderName, RecipientAddress, RecipientName, strSubject, strBody, isHTML)
if SenderName = "" then SenderName = SenderAddress
if RecipientName = "" then RecipientName = RecipientAddress
IF EmailComponent = "CDO" THEN
'Set mailObj = Server.CreateObject("CDONTS.NewMail")
'mailObj.From = SenderAddress
'mailObj.To = RecipientAddress
'mailObj.Subject = strSubject
'mailObj.Body = strBody
'mailObj.BodyFormat = 0
''mailObj.MailFormat = 0
'mailObj.Send
'CDO Message-------------
Set mailObj = Server.CreateObject("CDO.Message")
mailObj.To = RecipientAddress
mailObj.From = SenderAddress
mailObj.Subject = strSubject
mailObj.TextBody = strBody
mailObj.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")= 2
mailObj.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= RemoteHost
mailObj.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
= 25
mailObj.Configuration.Fields.Update
mailObj.Send
ELSEIF EmailComponent = "ASPMail" THEN
Set mailObj = Server.CreateObject("SMTPsvg.Mailer")
mailObj.ContentType = "text/html"
mailObj.FromName = SenderName
mailObj.FromAddress = SenderAddress
mailObj.RemoteHost = RemoteHost
mailObj.Subject = strSubject
mailObj.BodyText = strBody
mailObj.AddRecipient RecipientName, RecipientAddress
mailObj.SendMail
ELSEIF EmailComponent = "ASPEmail" THEN
Set mailObj = Server.CreateObject("Persits.MailSender")
mailObj.Host = RemoteHost
mailObj.From = SenderAddress
mailObj.FromName = SenderName
mailObj.AddAddress RecipientName, RecipientAddress
mailObj.Subject = strSubject
mailObj.Body = strBody
mailObj.IsHTML = True
mailObj.Send
ELSEIF EmailComponent = "JMail" THEN
Set mailObj = Server.CreateOBject("JMail.Message")
mailObj.Logging = True
mailObj.silent = False
mailObj.From = SenderAddress
mailObj.FromName = SenderName
mailObj.AddRecipient RecipientAddress
mailObj.Subject = strSubject
mailObj.Body = strBody
mailObj.Send("mail.sitewerkz.com")
END IF
End Function
Function UpdateBannerStatImp(BannerID)
If DATABASE = "MySQL" Then
thisDate = Year(Now) & "-" & Month(Now) & "-" & Day(Now)
thisDate = thisDate
Else
thisDate = Month(Now) &"/"& Day(Now) &"/"& Year(Now)
thisDate = cDate(thisDate)
End If
strSQL = "SELECT StatID, sBannerID, sImp, sDate FROM JBS_BannerStat WHERE sBannerID = " & BannerID & " AND sDate = " & dbDateSign(DATABASE) & thisDate & dbDateSign(DATABASE) & " "
Set objRS = Conn.Execute(strSQL)
if objRS.EOF Then
Conn.Execute "INSERT INTO JBS_BannerStat(sBannerID, sImp, sDate) values(" & BannerID & ", 1, " & dbDateSign(DATABASE) & thisDate & dbDateSign(DATABASE) & " )"
else
Conn.Execute "UPDATE JBS_BannerStat SET sImp = sImp + 1 WHERE StatID = " & objRS(0)
end if
objRS.Close : Set objRS = Nothing
Call returnLCID()
End Function
Function UpdateBannerStatClick(BannerID)
If DATABASE = "MySQL" Then
thisDate = Year(Now) & "-" & Month(Now) & "-" & Day(Now)
thisDate = thisDate
Else
thisDate = Month(Now) &"/"& Day(Now) &"/"& Year(Now)
thisDate = cDate(thisDate)
End If
strSQL = "SELECT StatID, sBannerID, sClick, sDate FROM JBS_BannerStat WHERE sBannerID = " & BannerID & " AND sDate = " & dbDateSign(DATABASE) & thisDate & dbDateSign(DATABASE) & " "
Set objRS = Conn.Execute(strSQL)
if objRS.EOF Then
Conn.Execute "INSERT INTO JBS_BannerStat(sBannerID, sClick, sDate) values(" & BannerID & ", 1, " & dbDateSign(DATABASE) & thisDate & dbDateSign(DATABASE) & " )"
else
Conn.Execute "UPDATE JBS_BannerStat SET sClick = sClick + 1 WHERE StatID = " & objRS(0)
end if
objRS.Close : Set objRS = Nothing
End Function
Function UpdateBannerImp(BannerID)
Conn.Execute "UPDATE JBS_Banners SET bImpCount = bImpCount + 1 WHERE BannerID = " & BannerID
End Function
Function UpdateBannerClick(BannerID)
Conn.Execute "UPDATE JBS_Banners SET bClickCount = bClickCount + 1 WHERE BannerID = " & BannerID
End Function
Function SetBannerStatus(BannerID)
strSQL = "SELECT BannerID, bStartDate, bEndDate, bStatus, bPaymentType, bQuantityPurchased, bImpCount, bClickCount "
strSQL = strSQL & "FROM JBS_Banners "
strSQL = strSQL & "WHERE BannerID = " & BannerID
Set objRS = Conn.Execute(strSQL)
IF Not objRS.EOF THEN
IF objRS("bStatus") <> "Hold" THEN
Dim strStatus : strStatus = "Active"
If objRS("bPaymentType") = Clng(1) then
if objRS("bQuantityPurchased") <> Clng(0) then
if objRS("bClickCount") >= objRS("bQuantityPurchased") then strStatus = "Expired"
end if
End If
If objRS("bPaymentType") = Clng(2) then
if objRS("bQuantityPurchased") <> Clng(0) then
if objRS("bImpCount") >= objRS("bQuantityPurchased") then strStatus = "Expired"
end if
End If
If cdate(objRS("bEndDate")) < Date() then
strStatus = "Expired"
End If
If strStatus <> "" Then
Conn.Execute "UPDATE JBS_Banners SET bStatus = '" & strStatus & "' WHERE BannerID = " & objRS("BannerID")
End If
END IF
END IF
End Function
Function strFinancialReport(Bannername,PaymentNo,bUnitCost,bQuantityPurchased,bImpCount,bClickCount,bStartDate,bEndDate,bStatus)
Dim strBannerStatus
Dim strBannerName
Dim strPayment
'Dim strPaymentType
Dim strIncome
If isNull(bUnitCost) Then bUnitCost = 0
If isNull(bQuantityPurchased) Then bQuantityPurchased = 0
If isNull(bImpCount) Then bImpCount = 0
If isNull(bClickCount) Then bClickCount = 0
Dim strGetLangStatus
if bStatus = "Active" then
strGetLangStatus = Application(getLang() & "_strJBS_00680")
elseif bStatus = "Hold" then
strGetLangStatus = Application(getLang() & "_strJBS_00690")
elseif bStatus = "Expired" then
strGetLangStatus = Application(getLang() & "_strJBS_00700")
else
strGetLangStatus = bStatus
end if
If PaymentNo = Clng(0) then
strPayment = Application(getLang() & "_strJBS_01450")
ElseIf PaymentNo = Clng(1) then
strPayment = Application(getLang() & "_strJBS_01460")
if bQuantityPurchased <> Clng(0) then
strIncome = "" & Application(getLang() & "_strJBS_01490") & ": " & bQuantityPurchased & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bQuantityPurchased * FormatCurrency(bUnitCost))) & " "
strIncome = strIncome & "" & Application(getLang() & "_strJBS_01510") & ": " & bClickCount & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bClickCount * FormatCurrency(bUnitCost))) & " "
strIncome = strIncome & "Click remaining: " & (bQuantityPurchased - bClickCount) & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bQuantityPurchased - bClickCount) * FormatCurrency(bUnitCost))& " "
else
strIncome = "" & Application(getLang() & "_strJBS_01490") & ": - "
strIncome = strIncome & "" & Application(getLang() & "_strJBS_01510") & ": " & bClickCount & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bClickCount * FormatCurrency(clng(bUnitCost)))) & " "
strIncome = strIncome & "" & Application(getLang() & "_strJBS_01540") & ": - "
end if
ElseIf PaymentNo = Clng(2) then
strPayment = Application(getLang() & "_strJBS_01470")
if bQuantityPurchased <> Clng(0) then
strIncome = "" & Application(getLang() & "_strJBS_01490") & ": " & bQuantityPurchased & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bQuantityPurchased * FormatCurrency(bUnitCost))) & " "
strIncome = strIncome & "" & Application(getLang() & "_strJBS_01520") & ": " & bImpCount & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bImpCount * FormatCurrency(bUnitCost))) & " "
strIncome = strIncome & "" & Application(getLang() & "_strJBS_01550") & ": " & (bQuantityPurchased - bImpCount) & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bQuantityPurchased - bImpCount) * FormatCurrency(bUnitCost))& " "
else
strIncome = "" & Application(getLang() & "_strJBS_01490") & ": - "
strIncome = strIncome & "" & Application(getLang() & "_strJBS_01520") & ": " & bImpCount & " aŽ " & FormatCurrency(bUnitCost) & " = " & FormatCurrency((bImpCount * FormatCurrency(bUnitCost))) & " "
strIncome = strIncome & "" & Application(getLang() & "_strJBS_01550") & ": - "
end if
ElseIf PaymentNo = Clng(3) then
strPayment = Application(getLang() & "_strJBS_01480")
strIncome = "" & Application(getLang() & "_strJBS_01440") & ": " & FormatCurrency(bUnitCost) & " (" & bStartDate & " - " & bEndDate & ")"
End If
strBannerStatus = "" & Application(getLang() & "_strJBS_00670") & ": " & strGetLangStatus & " "
strBannerName = "" & Application(getLang() & "_strJBS_01750") & ": " & BannerName & " "
strPaymentType = "" & Application(getLang() & "_strJBS_01430") & ": " & strPayment & " "
strFinancialReport = strBannerStatus & strBannerName & strPaymentType & strIncome
End Function
Function intIfEmty(getOne)
If getOne = "" or getOne = "0" or getOne = " " then getOne = "1"
intIfEmty = getOne
End Function
Function strLength(theString)
if Len(theString) => int(100) then
strLength = Left(theString, 100) & "..."
else
strLength = theString
end if
End Function
Function ChkString(string)
if string = " " then string = ""
ChkString = Replace(string, "'", "''")
End Function
Function BreakLine(string)
Dim breakString
breakString = Replace(string, "vbCrLf", "
")
BreakLine = breakString
End Function
Function ChkLink(strLink)
If Left(LCase(strLink),4) = "http" OR Left(LCase(strLink),4) = "mail" then
strLink = strLink
else
strLink = "http://" & strLink
End If
ChkLink = strLink
End Function
Function strWeekDayName(theDay)
if theDay = "1" then theDay = "Monday"
if theDay = "2" then theDay = "Tuesday"
if theDay = "3" then theDay = "Wednesday"
if theDay = "4" then theDay = "Thirsday"
if theDay = "5" then theDay = "Friday"
if theDay = "6" then theDay = "Saturday"
if theDay = "7" then theDay = "Sundag"
strWeekDayName = theDay
End Function
Function strMonthName(theMonth)
if theMonth = "1" then theMonth = "January"
if theMonth = "2" then theMonth = "February"
if theMonth = "3" then theMonth = "March"
if theMonth = "4" then theMonth = "April"
if theMonth = "5" then theMonth = "May"
if theMonth = "6" then theMonth = "June"
if theMonth = "7" then theMonth = "July"
if theMonth = "8" then theMonth = "August"
if theMonth = "9" then theMonth = "September"
if theMonth = "10" then theMonth = "October"
if theMonth = "11" then theMonth = "November"
if theMonth = "12" then theMonth = "December"
strMonthName = theMonth
End Function
Function WriteFormDate(Dte,DteDay,DteMonth,DteYear,SelectNameDay,SelectNameMonth,SelectNameYear,strFldStatus)
Response.Write ""
Response.Write " : "
Response.Write " - "
End Function
Function WriteBannerSelectList(SelectBannerID,strFldStatus)
Dim SQL, objRS_Banner
SQL = "SELECT BannerID, bName FROM JBS_Banners ORDER BY bName"
Set objRS_Banner = Conn.Execute(SQL)
IF objRS_Banner.EOF Or objRS_Banner.BOF Then
objRS_Banner.Close : Set objRS_Banner = Nothing
Else
if SelectBannerID <> "" then
selectNo = Clng(SelectBannerID)
else
selectNo = Clng(0)
end if
Response.Write ""
objRS_Banner.Close : Set objRS_Banner = Nothing
End If
End Function
Function WriteZoneSelectList(SelectZoneID,strFldStatus)
Dim SQL, objRS_Zone
SQL = "SELECT ZoneID, zName FROM JBS_Zones ORDER BY zName"
Set objRS_Zone = Conn.Execute(SQL)
IF objRS_Zone.EOF Or objRS_Zone.BOF Then
objRS_Zone.Close : Set objRS_Zone = Nothing
Else
if SelectZoneID <> "" then
selectNo = Clng(SelectZoneID)
else
selectNo = Clng(0)
end if
Response.Write ""
objRS_Zone.Close : Set objRS_Zone = Nothing
End If
End Function
Function WriteAdvertiserSelectList(SelectAdvertiserID,strFldStatus)
Dim SQL, objRS_Advertiser
SQL = "SELECT AdvertiserID, aCompanyName FROM JBS_Advertiser ORDER BY aCompanyName"
Set objRS_Advertiser = Conn.Execute(SQL)
IF objRS_Advertiser.EOF Or objRS_Advertiser.BOF Then
objRS_Advertiser.Close : Set objRS_Advertiser = Nothing
Else
if SelectAdvertiserID <> "" then
selectNo = Clng(SelectAdvertiserID)
else
selectNo = Clng(0)
end if
Response.Write ""
objRS_Advertiser.Close : Set objRS_Advertiser = Nothing
End If
End Function
Function WriteSubFolderSelectList(SubFolder,FormFldStatus)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(server.mappath("/JBSX/upload/images_files"))
Response.Write ""
Set objFolder = Nothing : Set objFSO = Nothing
End Function
%>