Skip to content

Instantly share code, notes, and snippets.

@paulhuisman
Created November 30, 2012 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulhuisman/4176596 to your computer and use it in GitHub Desktop.
Save paulhuisman/4176596 to your computer and use it in GitHub Desktop.
Cookies check PHP
<?php
$cookie_value = NULL;
if (!isset($_COOKIE['overlay_display'])) {
$cookie_value = TRUE;
setcookie("overlay_display", $cookie_value, time()+31536000); // Expire in one year
}
else {
$cookie_value = intval($_COOKIE['overlay_display'])+1;
setcookie("overlay_display", $cookie_value, time()+31536000);
}
if ($cookie_value == FALSE) {
$templateObject->parse('main.popup_lightbox');
}
echo '<h2>'.$cookie_value.'</h2>';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment