SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    FRANCE
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to do this kind of redirect on index page?

    Hi,
    here's what i mean in details, I've seen this on several sites:
    when you go to a website sometimes it shows you a full page ad (url is still the same in the address bar) and then it redirects you to the 'real' index page after say 10 seconds.

    I would like to be able to do that but I'm not sure how, if someone can help that'd be great...
    Thanks!

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Use a cookie. If no cookie is present, display an ad with a meta refresh to the same URL in the HTML, and set the cookie. If the cookie is present, display the normal site content.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2001
    Location
    FRANCE
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you, do you have examples of the codes to use?

  4. #4
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deejekyll View Post
    thank you, do you have examples of the codes to use?
    This should do it for you

    PHP Code:
    <?php
    if (!isset($_COOKIE['advert'])) {
      echo 
    '<meta http-equiv="refresh" content="10">';
      
    setcookie("advert""yes");// display your advert here    
      
    echo 'your ad goes here';
      exit;
    }
    // normal page here
    echo 'normal page here';?>
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming


Bookmarks

Posting Permissions

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