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=";
124 return ((function_exists(
'imagecreatetruecolor') || function_exists(
'imagecreate')) && $this->
getConfig()->getConfigParam(
'iUseGDVersion') > 1);
140 if (($aHash = $oSession->getVariable(
"aCaptchaHash"))) {
141 $blPass = (isset($aHash[$sMacHash][$sHash]) && $aHash[$sMacHash][$sHash] >= $iTime) ?
true :
false;
142 unset($aHash[$sMacHash]);
143 if (!empty($aHash)) {
144 $oSession->setVariable(
"aCaptchaHash", $aHash);
146 $oSession->deleteVariable(
"aCaptchaHash");
167 $sQ =
"select 1 from oxcaptcha where oxid = {$iMacHash} and oxhash = '{$sHash}'";
168 if (($blPass = (
bool) $oDb->getOne($sQ,
false,
false))) {
170 $sQ =
"delete from oxcaptcha where oxid = {$iMacHash} and oxhash = '{$sHash}'";
175 $sQ =
"delete from oxcaptcha where oxtime < $iTime";
189 public function pass($sMac, $sMacHash)
197 if ($blPass === null) {
198 $blPass = $this->
_passFromDb((
int) $sMacHash, $sHash, $iTime);
201 return (
bool) $blPass;