SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    0 Post(s)
    0 Thread(s)

    Avoiding PHP redirect loop.

    Hi guys.

    I'm currently helping out with CMS'ing a site for a band. As you may have seen, some sites by music groups have a "website cover" behind which the actual site is found. Here's the deal.

    The whole site is based on one index.php page with the dynamic part being just the center column, The band wants an option in their configuration interface, where they can switch the "website coverpage" option on and off themselves. It could be something like this: If the "coverpage" option is checked in their webinterface, the value of "1" is set in the parameters table in their DB, and a redirecting header is added to the top of the index.php page with PHP's file manipulation tools, which leads to a script that dynamically generates their fancy coverpage if the DB check returns "1".

    But how do i prevent this from looping over and over again when a visitor clicks the "enter site" button? As soon as the visitor lands on the index.php page from the coverpage, the visitor is bound to get redirected once again. What is the best way from a design perspective to prevent this from occurring? Is there a good way to make sure, that the second time that header is encountered by the browser, it's ignored during that visit so the rest of the site can be used without interference from it?

    Rock on.
    "There can be only one masterfarter"

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    West Springfield, Massachusetts
    198 Post(s)
    3 Thread(s)

    optional "splash" page - one view only

    I think the easiest way would be to use a SESSION variable. eg.
    $_SESSION['seen'] = "true";


Posting Permissions

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