%@ CODEPAGE=65001 %>
<%
response.charset = "utf-8"
%>
<% if Session("Admin") = "logged" then %>
<% else %>
<% end if %>
<%
TotalRecords = 10
'response.write Request.ServerVariables("HTTP_HOST")
UC = request("UC")
Dim PickBanner(300)
m = 0
NoUser = "NoSuchUser"
Set RS_GetConfig = MyConn.Execute("SELECT SiteConfig FROM affiliate where UserCode = '" & UC & "' ")
if RS_GetConfig.EOF then
CatArray = Split("a,b",",")
else
CatArray = Split(RS_GetConfig("SiteConfig"),",")
end if
'MySQL = "SELECT * FROM Advertisers where (TextBannerApprove = true and BannerChoice = 'T1') AND (UserCode = '" & NoUser & "' "
MySQL = "SELECT * FROM Advertisers where (TextBannerApprove = true and BannerChoice = 'T1') AND (UserCode = '" & NoUser & "' "
for i = 0 to UBound(CatArray)
MySQL = MySQL & "OR " & CatArray(i) & " = true "
next
MySQL = MySQL & ") and Status = true and IsActive = true and ClicksLeft > 0 and Usercode <> '" & UC & "'"
'response.write MySQL
Set RS_Ads = MyConn.Execute(MySQL)
if RS_Ads.EOF then
' Criteria is not met
NoCriteria = true
else
' Criteria is met
NoCriteria = false
' Get Total Number of Ads and pick a random one.
do while not RS_Ads.EOF
PickBanner(m) = RS_Ads("UniqueCode")
m = m + 1
RS_Ads.MoveNext
loop
for t = 0 to UBound(PickBanner)
if Len(PickBanner(t)) > 0 then
'response.write t & " - " & PickBanner(t) & " "
end if
next
' Determines how many unique random numbers to be produced
tot_unique=1
' Determines the highest value for any unique random number
top_number = m - 1
dim random_number, counter, check, unique_numbers
' When passing a varible for an array use redim
redim random_number(tot_unique)
' begin random function
randomize
' Begin a for next loop from one to the max number of unique numbers
For counter = 1 to tot_unique
' select a number between 1 and the top number value
random_number(counter) = Int(Rnd * top_number)+1
' For next loop to compare the values stored in the array to
' the new random value being assigned
for check=1 to counter-1
if random_number(check)= random_number(counter) then
' If the current value is equal to a previous value
' subject
counter=counter-1
end if
next ' Repeat loop to check values
next ' Repeat loop to assign values to the array
'write out the unique numbers in a list for display
'response.write "
" & & "
"
'Randomize()
'RandomID = int(rnd*m)
end if
%>
<% if NoCriteria = false then %>
<% For counter = 1 to tot_unique
'response.write random_number(counter) & " "
%>
<% Set RS_Text = MyConn.Execute("SELECT * FROM T1 where UniqueCode = '" & PickBanner(random_number(counter)) & "' ")
Set RS = MyConn.Execute("SELECT * FROM Advertisers where UniqueCode = '" & PickBanner(random_number(counter)) & "' ")
NewImpression = RS("MyImpressions") + 1
Set RS_Update = MyConn.Execute("UPDATE Advertisers SET MyImpressions = "& NewImpression &" WHERE UniqueCode = '" & PickBanner(random_number(counter)) & "';")
MyTitle = RS_Text("Title")
MyMessage = RS_Text("Message") %>
<%
u_file = "../icons/" & RS_Text("UniqueCode") & ".gif"
set fso = createobject("scripting.filesystemobject")
if fso.FileExists (server.mappath(u_file)) then
IconExists = true
else
IconExists = false
end if
if Len(RS_Text("IconName")) > 3 then
IconExists = true
u_file = "../iconbank/" & RS_Text("IconName")
end if
'response.write IconExists
%>
<% if IconExists = true then%>