return $c->solved(); } public static function check() { return captcha::solved(); } #-- returns string with "<img> and <input>" fields for display in your <form> public static function form($text = "") { $c = new easy_captcha(); return $c->form("{$text}"); } } #-- init (triggered if *this* script is called directly) if (basename($_SERVER["SCRIPT_FILENAME"]) == basename(__FILE__) or easy_captcha_utility::canonical_path("http://ignored.xxx/{$_SERVER['REQUEST_URI']}") == easy_captcha_utility::canonical_path(CAPTCHA_BASE_URL)) { easy_captcha_utility::API(); } /* base logic and data storare */ class easy_captcha { #-- init data function __construct($id = NULL, $ignore_expiration = 0) { #-- load if ($this->id = $id or $this->id = preg_replace("/[^-,.\\w]+/", "", @$_REQUEST[CAPTCHA_PARAM_ID])) { $this->load(); } #-- create new if (empty($this->id) || !$ignore_expiration && !$this->is_valid() && $this->log("new()", "EXPIRED", "regenerating store")) { $this->generate(); }