Skip to content

Instantly share code, notes, and snippets.

@nikolaykrylov
Last active March 10, 2017 20:56
Show Gist options
  • Save nikolaykrylov/bda6898740014c66c0516f37767372ab to your computer and use it in GitHub Desktop.
Save nikolaykrylov/bda6898740014c66c0516f37767372ab to your computer and use it in GitHub Desktop.
Counts how many times user visited site (using cookies)
<?php
$count = 1;
if (isset($_COOKIE['counter'])){
$count = intval($_COOKIE['counter']);
$count ++;
}
setcookie('counter', $count);
echo "Вы посетили сайт $count раз";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment