Results 1 to 4 of 4

Thread: [Cookies]

  1. #1
    Join Date
    Jan 2005
    Location
    North-East, Indiana
    Posts
    417

    [Cookies]

    Ok I want to create a cookie for 12 hours called "viewed"

    and I want it to go like this

    if isset { do nothing } else { set cookie & more code } help please!
    PHP5 / MySQL / CUSTOM TEMPLATING / CLEAN & MAINTAINABLE CODING
    WEB DEVELOPMENT via CUSTOM DESIGN / PROGRAMMING

  2. #2
    Join Date
    Feb 2003
    Location
    Connecticut
    Posts
    5,441
    PHP Code:
    <?php
    if($_COOKIE['viewed'] != 'yes') {
    // code
    } else {
    setcookie('viewed','yes',time() + (60 60 12));
    // code
    }
    ?>

  3. #3
    Join Date
    May 2007
    Location
    Orange Country, CA
    Posts
    138
    This should do it.

    PHP Code:
     <?php 

    if(!isset($_COOKIE['viewed'])) { 
         
    setcookie("viewed""true"time() + (60*60*12)); 
         
    // Do other stuff


    ?>
    Blesta - Professional Billing Software
    We are about creating good experiences
    Trial - Demo | 866.478.7567 | Twitter @blesta

  4. #4
    Quote Originally Posted by Codelphious View Post
    This should do it.

    PHP Code:
     <?php 

    if(!isset($_COOKIE['viewed'])) { 
         
    setcookie("viewed""true"time() + (60*60*12)); 
         
    // Do other stuff


    ?>
    just for the record,
    (60*60*12), it's egal to 60 seconds * 60 minutes* 12 hours

Posting Permissions

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