Results 1 to 4 of 4
  1. #1

    small php[?] code needed

    hello
    i am wondering how i can do this:
    something like ign.com do..
    when a visitor first go to ign.com it watch a splash with advertisment.. for 1 time..
    after that if it visit ign.com again it goes to the main..
    i supposed it have to do with cookies..
    well i want first to go at index.php?act=splash and after the first visit to go at index.php?act=idx
    any luck ?
    heh

  2. #2
    This should do it:

    index.php
    PHP Code:
    <?
    function idx() {
      echo 
    "This is the index page";
    }
    function 
    splash() {
      
    // Set cookies and after advertisement redirect
      
    echo "Splash Page<br /><a href=\"index.php?act=idx\">Index</a>";
    }

    switch(
    $_GET["act"]) {

        case 
    "idx":
        
    idx();
        break;

        default:
        
    splash();
        break;
    }
    ?>

    Matt
    http://www.theextremenetwork.com
    MSN: [email protected]

  3. #3
    erm actually its not that i ask but thanks
    i mean .. again if u still access the index.php for 2nd time it would go at index.php?act=splash ..

  4. #4
    Ok, here you go:
    PHP Code:
    <?
    if (isset($_COOKIE['splash'])) { // Go to index

    }
    else { 
    // Show splash
      
    setcookie("splash""" time()+86400);
      echo 
    "Advertisement";
    }
    ?>
    Matt
    http://www.theextremenetwork.com
    MSN: [email protected]

Posting Permissions

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