<%
'*******************************************************************************
' Get Ads HTML from Recipe2 database
' To get the ad you need to provide the Page name where the ad will be placed
' and also the ad location number. Now in this particular location you can
' have multiple banner ads. It will display one ad banner at a time.
' So first insert the banner ad information in the database, then place the HTML code
' in the proper place and specify the page name and location id (which you had entered
' in the database.
'*******************************************************************************
Function AdRotator(PageFileName, adLocation)
Dim rs, sql, count, i, AdHTML, MyRandNo, cnnString
cnnString = Application("Angithi_ConnectionString")
sql = "SELECT * FROM Ad WHERE Status='ON'" & _
" AND PageFileName = '" & PageFileName & "'" & _
" AND adLocation = '" & adLocation & "'"
set rs = server.CreateObject("ADODB.recordset")
rs.Open sql, cnnString, 3
count = rs.Recordcount
'Response.write sql
'Response.write count
'response.end
Randomize
MyRandNo = Int((count * Rnd) + 1)
'Response.write MyRandNo
i = 0
Do while i <> MyRandNo and not rs.eof
AdHTML = rs("AdHTML")
i = i + 1
rs.movenext
Loop
rs.close
Set rs = Nothing
AdRotator = AdHTML
End Function
%>
 |
<%=AdRotator("banner.htm", "TOP")%> |
|
|
|
|
|