function userUpdateExcludeVisitsCookie() { global $_COOKIE; if (!isLoggedIn()) { return; } if (userExcludeMyVisits()) { if (!isset($_COOKIE['excludemyvisits'])) { $exclid = createSecureId(userId(), "excludeid"); setCookie("excludemyvisits", $exclid, 2147483647, "/"); } } else { if (isset($_COOKIE['excludemyvisits'])) { setCookie("excludemyvisits", "", time() - 3600 * 48, "/"); } } }
<?php $r = redisLink(); $lastvisit = $r->lindex("last:" . userId(), -1); $statusok = false; if ($lastvisit) { $row = unserialize($lastvisit); if (time() - $row['time'] < 3600 * 24) { $statusok = true; } } if ($statusok) { echo "We are correctly receiving data"; } else { echo "We are NOT receiving data, make sure to install the javascript tag in your web site"; } $excludechecked = userExcludeMyVisits() ? "checked" : ""; $showuseragent = userShowUserAgent() ? "checked" : ""; $savedhtml = gi("s", 0) ? ' <span id="saved" style="color:red">(saved)</span>' : ''; ?> <h3>Options<?php echo $savedhtml; ?> </h3> <form method="post" action="usercode.php" id="optionsform"> Don't log my own visits <input type="checkbox" name="excludemyvisits" value="1" <?php echo $excludechecked; ?> ><br/><br/> Show clients user agent <input type="checkbox" name="showuseragent" value="1" <?php echo $showuseragent; ?>