+ Reply to Thread
Results 1 to 5 of 5

Thread: cookies

  1. #1

    cookies

    I decided for my website that there should be an intro page, but it would only show once;
    I tried writing a script at /index.php
    but can't seem to get the cookies set right.
    PHP Code:
    <?php

    if (!isset($_COOKIE['cookie'])) {
       
    setcookie("cookie""yep"time() + 3600000);
        }

    if (
    $_COOKIE['cookie'] != "1")  
            {   
                
    $cookie_data='1';
                
    setcookie("cookie"$cookie_datatime()+3600000);
                
    //echo '<meta http-equiv="Refresh" content="1;url=http://www.konputer.org/intro.html">';
                
    echo "cookie set.. ";
                echo 
    $_COOKIE['cookie'];
                
            };
            

    ?>
    (after this html begins for the main page...)

  2. #2
    Full Member dzone is on a distinguished road
    Join Date
    Dec 2003
    Posts
    75
    Hi!

    setcookie("cookie", "yep", time() + 3600000);

    should probably be

    setcookie("cookie", "1", time() + 3600000);

    HTH,
    Z.
    ------------------------------------
    [URL=http://www.dedicatedzone.com]Managed Dedicated Servers[\URL]

  3. #3
    Full Member Marshall is on a distinguished road
    Join Date
    May 2004
    Posts
    69
    Also at the end, you dont need the ; after the } for the end of the if. And the cookies settings are correct because if he changed it to 1 then it would always skip the intro and never play it. You could actually delete the first if and just go if theres no $_COOKIE['cookie'] then run the intro and set it and if there is one to skip it.

  4. #4
    thanks a lot.. seems to work fine now!

  5. #5
    Full Member Marshall is on a distinguished road
    Join Date
    May 2004
    Posts
    69
    No problem, glad to hear it helped

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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