Skip to content

Instantly share code, notes, and snippets.

@harikt
Created May 15, 2014 08:24
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 harikt/acd34c21a799255cef2d to your computer and use it in GitHub Desktop.
Save harikt/acd34c21a799255cef2d to your computer and use it in GitHub Desktop.
Something is wrong. But now working fine
<?php
if (isset($_COOKIE['counter'])) {
$counter = $_COOKIE['counter'];
echo $counter;
$counter++;
setcookie('counter', $counter, time() + 60*60*24*30, '/', '', false, true);
} else {
setcookie('counter', 1, time() + 60*60*24*30, '/', '', false, true);
}
<?php
if (isset($_COOKIE['counter'])) {
$counter = $_COOKIE['counter'];
if ($counter%2 == 0) {
echo "Even";
} else {
echo "Odd";
}
echo $counter;
$counter++;
setcookie('counter', $counter, time() + 60*60*24*30, '/', '', false, true);
} else {
setcookie('counter', 1, time() + 60*60*24*30, '/', '', false, true);
}
@harikt
Copy link
Author

harikt commented Aug 6, 2014

@m6w6 no favicon is here see the php script .

@ramondelafuente Yes the script was started with php -S . Sorry for the delay guyes, I missed to see the comments. I am not sure why gist comments are not mailed by github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment