ASP Page to cycle re-directs

Discussion in 'ASP General' started by Paul, Apr 4, 2009.

  1. Paul

    Paul Guest

    Hi,
    I have a database (MSAccess 97) that contains all the links on my website,
    and I want to create an "I feel lucky" page similar to what Google does.

    The links that are to be included are in a table as follows

    LINK_ID | LINK_PATH | CURRENT_Y/N | NEXT_LINK

    1 | http://www....| Y | 2

    (I hope that makes sense in your newsreader)

    The idea is that my visitors will open a page (feeling_lucky.asp) and it
    will take them to which ever record is current, and then change the current
    record so in the example above it would re-direct to the path but firstly
    change LINK_ID 1's CURRENT_Y/N field to a "N", and then update LINK_ID 2's
    CURRENT_Y/N field to a "Y" ready for the next visitor.

    I have tried to do this but I'm not sure if I'm going about it the wrong
    way, so I thought I'd ask for your advice.


    My questions are:

    Is there a better way of doing this ? ( I don't want the visits to be
    random, each link must get equal traffic)

    Can it all be done in 1 ASP page, or will it need several ( 1 to get the
    LINK_PATH and NEXT_LINK and pass them as a URL parameter, then 1 to update
    the current record, then 1 to update the next record )?


    I'd be grateful of any advice, or examples you can offer.

    The project has 2 purposes, "I feel lucky" and then to monitor which
    products are the best to display in our Offers area, so each visitor gets a
    different page of offers, then I can see which products are genuinely good
    sellers,and which are pants items nobody wants to buy.

    Thanks for your help

    Paul
     
    Paul, Apr 4, 2009
    #1
    1. Advertising

  2. Paul

    Paul Guest

    OK,
    I managed to do this, so for anyone who's interested, heres what I did.

    I have 1 page that stores the LINK_PATH and NEXT_LINK values in variables,
    then updates all CURRENT_Y/N fields to "N", then updates the record where
    LINK_ID ,matches my stored variable for NEXT_LINK so its CURRENT_Y/N value =
    "Y".

    In the event that the page is loaded and EOF is true, then it redirects to a
    Reset page, that updates all CURRENT_Y/N fields to "N" and updates my
    homepage to a "Y", then the reset page redirects back to the page mentioned
    in the above paragraph.

    If anyone knows a better way, i'd be happy to learn from you.

    I now have a new question, having built this, I use the following in a line
    of code:

    Response.redirect("Http://localhost/OUTBOUND.asp?DESTINATION=" &
    (My_Query.Fields.Item("LINK_PATH").Value))


    How do I automatically change the domain from Http://localhost/ so I can use
    the same pages in multiple different domains without having to change the
    code manually?

    I only have to do 2, so its not really a problem but I just wanted to learn
    how to do it.

    Thanks

    Paul


    "Paul" <> wrote in message
    news:ujrvC%...
    > Hi,
    > I have a database (MSAccess 97) that contains all the links on my
    > website, and I want to create an "I feel lucky" page similar to what
    > Google does.
    >
    > The links that are to be included are in a table as follows
    >
    > LINK_ID | LINK_PATH | CURRENT_Y/N | NEXT_LINK
    >
    > 1 | http://www....| Y | 2
    >
    > (I hope that makes sense in your newsreader)
    >
    > The idea is that my visitors will open a page (feeling_lucky.asp) and it
    > will take them to which ever record is current, and then change the
    > current record so in the example above it would re-direct to the path but
    > firstly change LINK_ID 1's CURRENT_Y/N field to a "N", and then update
    > LINK_ID 2's CURRENT_Y/N field to a "Y" ready for the next visitor.
    >
    > I have tried to do this but I'm not sure if I'm going about it the wrong
    > way, so I thought I'd ask for your advice.
    >
    >
    > My questions are:
    >
    > Is there a better way of doing this ? ( I don't want the visits to be
    > random, each link must get equal traffic)
    >
    > Can it all be done in 1 ASP page, or will it need several ( 1 to get the
    > LINK_PATH and NEXT_LINK and pass them as a URL parameter, then 1 to update
    > the current record, then 1 to update the next record )?
    >
    >
    > I'd be grateful of any advice, or examples you can offer.
    >
    > The project has 2 purposes, "I feel lucky" and then to monitor which
    > products are the best to display in our Offers area, so each visitor gets
    > a different page of offers, then I can see which products are genuinely
    > good sellers,and which are pants items nobody wants to buy.
    >
    > Thanks for your help
    >
    > Paul
     
    Paul, Apr 4, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Familyman
    Replies:
    1
    Views:
    402
    Familyman
    Nov 2, 2005
  2. Familyman
    Replies:
    4
    Views:
    3,001
    Jonathan N. Little
    Nov 2, 2005
  3. AtomicBob
    Replies:
    14
    Views:
    968
    Toby Inkster
    May 2, 2006
  4. lander
    Replies:
    5
    Views:
    2,612
    Mark Rae [MVP]
    Mar 3, 2008
  5. Donn Cave
    Replies:
    0
    Views:
    418
    Donn Cave
    Apr 11, 2008
Loading...

Share This Page