49 $this->_sText .= strtolower($this->_sMacChars{rand(0, strlen($this->_sMacChars) - 1)});
71 if ($session->isSessionStarted()) {
73 $aHash = $session->getVariable(
"aCaptchaHash");
74 $aHash[$sHash] = array($sTextHash => $iTime);
75 $session->setVariable(
"aCaptchaHash", $aHash);
78 $sQ =
"insert into oxcaptcha ( oxhash, oxtime ) values ( '{$sTextHash}', '{$iTime}' )";
80 $sHash = $oDb->getOne(
"select LAST_INSERT_ID()",
false,
false);
99 $sText = strtolower($sText);
101 return md5(
"ox{$sText}");
111 $sUrl = $this->
getConfig()->getCoreUtilsURL() .
"verificationimg.php?e_mac=";
112 $sKey = $this->
getConfig()->getConfigParam(
'captchaKey');
113 $sKey = empty($sKey) ? null : $sKey;
126 return ((function_exists(
'imagecreatetruecolor') || function_exists(
'imagecreate')) && $this->
getConfig()->getConfigParam(
'iUseGDVersion') > 1);
142 if (($aHash = $oSession->getVariable(
"aCaptchaHash"))) {
143 $blPass = (isset($aHash[$sMacHash][$sHash]) && $aHash[$sMacHash][$sHash] >= $iTime) ?
true :
false;
144 unset($aHash[$sMacHash]);
145 if (!empty($aHash)) {
146 $oSession->setVariable(
"aCaptchaHash", $aHash);
148 $oSession->deleteVariable(
"aCaptchaHash");
169 $sQ =
"select 1 from oxcaptcha where oxid = {$iMacHash} and oxhash = '{$sHash}'";
170 if (($blPass = (
bool) $oDb->getOne($sQ,
false,
false))) {
172 $sQ =
"delete from oxcaptcha where oxid = {$iMacHash} and oxhash = '{$sHash}'";
177 $sQ =
"delete from oxcaptcha where oxtime < $iTime";
191 public function pass($sMac, $sMacHash)
199 if ($blPass === null) {
200 $blPass = $this->
_passFromDb((
int) $sMacHash, $sHash, $iTime);
203 return (
bool) $blPass;