public function getHash($text = null)
    {
        // inserting captcha record
        $time = time() + $this->timeout;
        $textHash = $this->getTextHash($text);

        // if session is started - storing captcha info here
        $session = $this->getSession();
        if ($session->isSessionStarted()) {
            $hash = oxUtilsObject::getInstance()->generateUID();
            $hashArray = $session->getVariable('captchaHashes');
            $hashArray[$hash] = array($textHash => $time);
            $session->setVariable('captchaHashes', $hashArray);
        } else {
            $database = DatabaseProvider::getDb();
            $query = "insert into oecaptcha (oxhash, oxtime) values (" .
                      $database->quote($textHash) . ", " . $database->quote($time) . ")";
            $database->execute($query);
            $hash = $database->getOne('select LAST_INSERT_ID()', false, false);
        }

        return $hash;
    }
public function getHash($text = null)
    {
        // inserting captcha record
        $time = time() + $this->timeout;
        $textHash = $this->getTextHash($text);

        // if session is started - storing captcha info here
        $session = $this->getSession();
        if ($session->isSessionStarted()) {
            $hash = oxUtilsObject::getInstance()->generateUID();
            $hashArray = $session->getVariable('captchaHashes');
            $hashArray[$hash] = array($textHash => $time);
            $session->setVariable('captchaHashes', $hashArray);
        } else {
            $database = DatabaseProvider::getDb();
            $query = "insert into oecaptcha (oxhash, oxtime) values (" .
                      $database->quote($textHash) . ", " . $database->quote($time) . ")";
            $database->execute($query);
            $hash = $database->getOne('select LAST_INSERT_ID()', false, false);
        }

        return $hash;
    }
public function getHash ( $ text = null ) { // inserting captcha record $ time = time ( ) + $ this -> timeout ; $ textHash = $ this -> getTextHash ( $ text ) ; // if session is started - storing captcha info here $ session = $ this -> getSession ( ) ; if ( $ session -> isSessionStarted ( ) ) { $ hash = oxUtilsObject :: getInstance ( ) -> generateUID ( ) ; $ hashArray = $ session -> getVariable ( 'captchaHashes' ) ; $ hashArray [ $ hash ] = array ( $ textHash => $ time ) ; $ session -> setVariable ( 'captchaHashes' , $ hashArray ) ; } else { $ database = DatabaseProvider :: getDb ( ) ; $ query = "insert into oecaptcha (oxhash, oxtime) values (" . $ database -> quote ( $ textHash ) . ", " . $ database -> quote ( $ time ) . ")" ; $ database -> execute ( $ query ) ; $ hash = $ database -> getOne ( 'select LAST_INSERT_ID()' , false , false ) ; } return $ hash ; }
Returns text hash

@param string $text User supplie text

@return string
Returns text hash