50 $this->_sText .= strtolower($this->_sMacChars{rand(0, strlen($this->_sMacChars) - 1)});
72 if ($session->isSessionStarted()) {
74 $aHash = $session->getVariable(
"aCaptchaHash");
75 $aHash[$sHash] = array($sTextHash => $iTime);
76 $session->setVariable(
"aCaptchaHash", $aHash);
79 $sQ =
"insert into oxcaptcha ( oxhash, oxtime ) values ( '{$sTextHash}', '{$iTime}' )";
81 $sHash = $oDb->getOne(
"select LAST_INSERT_ID()",
false,
false);
100 $sText = strtolower($sText);
102 return md5(
"ox{$sText}");
112 $sUrl = $this->
getConfig()->getCoreUtilsURL() .
"verificationimg.php?e_mac=";
113 $sKey = $this->
getConfig()->getConfigParam(
'captchaKey');
114 $sKey = empty($sKey) ? null : $sKey;
127 return ((function_exists(
'imagecreatetruecolor') || function_exists(
'imagecreate')) && $this->
getConfig()->getConfigParam(
'iUseGDVersion') > 1);
143 if (($aHash = $oSession->getVariable(
"aCaptchaHash"))) {
144 $blPass = (isset($aHash[$sMacHash][$sHash]) && $aHash[$sMacHash][$sHash] >= $iTime) ?
true :
false;
145 unset($aHash[$sMacHash]);
146 if (!empty($aHash)) {
147 $oSession->setVariable(
"aCaptchaHash", $aHash);
149 $oSession->deleteVariable(
"aCaptchaHash");
170 $sQ =
"select 1 from oxcaptcha where oxid = {$iMacHash} and oxhash = '{$sHash}'";
171 if (($blPass = (
bool) $oDb->getOne($sQ,
false,
false))) {
173 $sQ =
"delete from oxcaptcha where oxid = {$iMacHash} and oxhash = '{$sHash}'";
178 $sQ =
"delete from oxcaptcha where oxtime < $iTime";
192 public function pass($sMac, $sMacHash)
200 if ($blPass === null) {
201 $blPass = $this->
_passFromDb((
int) $sMacHash, $sHash, $iTime);
204 return (
bool) $blPass;