Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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