protected function passFromDb($macHash, $hash, $time)
    {
        $database = DatabaseProvider::getDb();
        $where = "where oxid = " . $database->quote($macHash) . " and oxhash = " . $database->quote($hash);
        $query = "select 1 from oecaptcha " . $where;
        $pass = (bool) $database->getOne($query, false, false);

        if ($pass) {
            // cleanup
            $query = "delete from oecaptcha " . $where;
            $database->execute($query);
        }

        // garbage cleanup
        $query = "delete from oecaptcha where oxtime < $time";
        $database->execute($query);

        return $pass;
    }