...

View Full Version : Help with banner ad...



malhyp
01-23-2007, 06:57 AM
Hey there... Can one help me with the follwong code?

The banner ad i have installed seems to work almost fine. When you click onto the pic (banner ad) it takes me to the address below instead of the one intended.

<%
Response.Buffer=True

'Define our ADO constants
const adOpenStatic = 3
const adLockOptimistic = 3

'----- Create and Open Connection
Set MyConnection = Server.CreateObject("ADODB.Connection")
MyConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\blablabla"
MyConnection.Open

'----- Pick Ad from database
SQLBanner = "Select * from Banner"
Set Banners = Server.CreateObject("ADODB.Recordset")
Banner.CursorType = adOpenStatic
BannersLockType = adLockOptimistic
Banner.Open SQLBanners, MyConnection

Randomize Timer
Banner.Move Int(RND * CInt(Banner.RecordCount))

'----- Increment Shown field value
Banner("Shown") = Banner("Shown") + 1
Banner.Update

' <a href="RedirectMe.asp?URL="www.google.com&BannerID="1"" "target="blank">image</a>

'----- Create and display Response
ImageString = "<img src=""" & Banner("Image") & """ alt=""" & Banner("Hint") & """>"
'ImageString = "<a href=""" & Banner("Image") & """ target=""_blank""><img src=""" & Banner("Image") & """ alt=""" & Banner("Hint") & """></a>"
ResponseString = "<a href=""RedirectMe.asp?URL=" & Banner("URL")
ResponseString = ResponseString & "&BannerID=" & Banner("BannerID") & """" & " " & "target=""_blank""" & ">" & ImageString & "</a>"
Response.Write ResponseString
'Response.End

'----- Clean up memory
Banner.Close
MyConnection.Close
Set Banner=Nothing
Set MyConnection=Nothing
%>

---------------------------------------------------------
Takes me here...
http://www.example.com/html/products/RedirectMe.asp?URL=www.test.com&BannerID=1

But need it to go here...
www.test.com

Can anyone tell me what I am doing wrong?

Mally

jerusking
01-25-2007, 12:20 PM
There most be something wrong with your querystring

it most be like these

http://www.example.com/html/products...com?BannerID=1

with a ? not &

hope it helps:thumbsup:

degsy
01-30-2007, 03:10 PM
You need RedirectMe.asp to take the url and response.reidrect

malhyp
01-30-2007, 09:13 PM
Thanks for that. We discovered that the RedirectMe.asp page was in the wrong directory.

Thanks to all for your help.

Cheers
Mally



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum