Fix captcha bug caused by different decimal point in some environments
This commit is contained in:
parent
802837959a
commit
0f855daa71
|
@ -158,10 +158,10 @@ function generate_code($length = 7) {
|
|||
foreach($charset as $char) {
|
||||
$balanced = $freqs[$char] / $sum;
|
||||
$bsum += $balanced;
|
||||
$xfq[(string)$bsum] = $char;
|
||||
$xfq[$char] = $bsum;
|
||||
}
|
||||
$roll = frand();
|
||||
foreach($xfq as $freq => $letter) {
|
||||
foreach($xfq as $letter => $freq) {
|
||||
if($roll < $freq) {
|
||||
$result[$i] = $letter;
|
||||
$roll = 2;
|
||||
|
|
Loading…
Reference in New Issue