/** * check_captcha() * * @param string $captcha * @param boolean $timer (on|off)(true|false) * @return boolean */ function check_captcha($captcha, $timer = true) { global $error_captcha; $captcha = htmlspecialchars(stripslashes(trim($captcha))); if (empty($captcha)) { $error_captcha = ERROR_MESSAGE_CAPTCHA; remove_cookie(); return false; } elseif (isset($_COOKIE['Captcha'])) { list($Hash, $Time) = explode('.', $_COOKIE['Captcha']); if (md5(SALTING . $captcha . $_SERVER['REMOTE_ADDR'] . $Time) != $Hash) { $error_captcha = ERROR_MESSAGE_CAPTCHA_INVALID; remove_cookie(); return false; } elseif (time() - COOKIE_TIMER * 60 > $Time && $timer) { $error_captcha = ERROR_MESSAGE_CAPTCHA_TIMED_OUT; remove_cookie(); return false; } } else { $error_captcha = ERROR_MESSAGE_CAPTCHA_COOKIE; return false; } return true; }
static function logout() { remove_cookie('user'); }
/** * Destroys the session, removing all data stored in this session and * removing any reference to this session. */ public function session_destroy() { # Remove cookie remove_cookie($this->sign($this->session->id, $this->session->salt)); # Remove session from database $this->session->delete(); }