--- a/helper.php 2013-04-29 06:50:38.000000000 +0900
+++ b/helper.php 2013-05-05 19:55:44.000000000 +0900
@@ -88,7 +88,7 @@
}
break;
}
- $out .= ' ';
+ $out .= ' ';
// add honeypot field
$out .= '';
@@ -150,11 +150,18 @@
$numbers = md5($rand * $fixed); // combine both values
// now create the letters
+/*
$code = '';
for($i=0;$i<10;$i+=2){
$code .= chr(floor(hexdec($numbers[$i].$numbers[$i+1])/10) + 65);
}
-
+*/
+ $strTable = 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゐゆゑよらりるれろわをん';
+ $strLength = mb_strlen($strTable);
+ $code = '';
+ for ($i=0;$i<10;$i+=2){
+ $code .= mb_substr($strTable, hexdec($numbers[$i].$numbers[$i+1])%$strLength, 1);
+ }
return $code;
}
@@ -203,7 +210,7 @@
}
// draw the letters
- for ($i = 0; $i < strlen($text); $i++){
+ for ($i = 0; $i < mb_strlen($text); $i++){
$font = $fonts[array_rand($fonts)];
$color = imagecolorallocate($img, rand(0, 100), rand(0, 100), rand(0, 100));
$size = rand(floor($h/1.8),floor($h*0.7));
@@ -213,7 +220,7 @@
$cheight = $size + ($size*0.5);
$y = floor($h / 2 + $cheight / 3.8);
- imagettftext($img, $size, $angle, $x, $y, $color, $font, $text[$i]);
+ imagettftext($img, $size, $angle, $x, $y, $color, $font, mb_substr($text, $i, 1));
}
header("Content-type: image/png");