summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TCaptchaValidator.php
diff options
context:
space:
mode:
authorxue <>2007-08-30 15:40:24 +0000
committerxue <>2007-08-30 15:40:24 +0000
commitd1875fd32e0aa7a093544b5decd0b43499424d4f (patch)
tree223c67445e9a204cabf93274061e506889a2090a /framework/Web/UI/WebControls/TCaptchaValidator.php
parent8a6d62fbe24321bdd83afa118726f2bd14c7dfb3 (diff)
further enhanced TCaptcha.
Diffstat (limited to 'framework/Web/UI/WebControls/TCaptchaValidator.php')
-rw-r--r--framework/Web/UI/WebControls/TCaptchaValidator.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/framework/Web/UI/WebControls/TCaptchaValidator.php b/framework/Web/UI/WebControls/TCaptchaValidator.php
index 4385bbfe..6d2c8f4c 100644
--- a/framework/Web/UI/WebControls/TCaptchaValidator.php
+++ b/framework/Web/UI/WebControls/TCaptchaValidator.php
@@ -102,16 +102,23 @@ class TCaptchaValidator extends TBaseValidator
$control=$this->findCaptchaControl();
if($control->getCaseSensitive())
{
- $options['TokenHash']=crc32($control->getToken());
+ $options['TokenHash']=$this->generateTokenHash($control->getToken());
$options['CaseSensitive']=true;
}
else
{
- $options['TokenHash']=crc32(strtoupper($control->getToken()));
+ $options['TokenHash']=$this->generateTokenHash(strtoupper($control->getToken()));
$options['CaseSensitive']=false;
}
return $options;
}
+
+ private function generateTokenHash($token)
+ {
+ for($h=0,$i=strlen($token)-1;$i>=0;--$i)
+ $h+=ord($token[$i]);
+ return $h;
+ }
}
?> \ No newline at end of file