Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    70
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Help with banner ad...

    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...com&BannerID=1

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

    Can anyone tell me what I am doing wrong?

    Mally

  • #2
    New Coder
    Join Date
    Jan 2007
    Posts
    34
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need RedirectMe.asp to take the url and response.reidrect

  • #4
    New Coder
    Join Date
    Jun 2006
    Posts
    70
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks for that. We discovered that the RedirectMe.asp page was in the wrong directory.

    Thanks to all for your help.

    Cheers
    Mally


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •