/** * logout - Gets called when the user wants to be logged out of the * website. It deletes any cookies that were stored on the users * computer as a result of him wanting to be remembered, and also * unsets session variables and demotes his user level to guest. */ function logout() { global $database; traceCalls(__METHOD__, __LINE__); if (isset($_COOKIE['cookname']) && isset($_COOKIE['cookid'])) { setcookie("cookname", "", time() - COOKIE_EXPIRE, COOKIE_PATH, '', COOKIE_SECURE, true); setcookie("cookid", "", time() - COOKIE_EXPIRE, COOKIE_PATH, '', COOKIE_SECURE, true); setcookie("cookcsrf", "", time() - COOKIE_EXPIRE, COOKIE_PATH, '', COOKIE_SECURE, true); } /* Unset PHP session variables */ /**** Integration with shift science on date 24-12-2013******/ $this->getLoginSiftData('logout_event', $_SESSION['userid']); unset($_SESSION['username']); unset($_SESSION['userid']); unset($_SESSION['language']); unset($_SESSION['frnds_emails']); unset($_SESSION['frnds_msg']); unset($_SESSION['la']); unset($_SESSION['loanapp']); unset($_SESSION['sublevel']); unset($_SESSION['CountryByIp']); unset($_SESSION['Nodonationincart']); unset($_SESSION['pcomment']); unset($_SESSION['feedback']); /* Reflect fact that user has logged out */ $this->logged_in = false; $this->username = GUEST_NAME; $this->userlevel = GUEST_LEVEL; session_destroy(); // Prevent aliasing new lenders to this distinct_id $distinct_id = Mixpanel::getDistinctId(); $isUserId = $database->isUserId($distinct_id); if (!$isUserId) { Mixpanel::clearCookie(); } }