cvs: pearweb /public_html captcha-image.php
| From: | Daniel Convissor | Date: | Sat, 14 Aug 2004 23:06:06 +0000 |
| Subject: | cvs: pearweb /public_html captcha-image.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-22905@lists.php.net to get a copy of this message | ||
danielc Sat Aug 14 19:06:06 2004 EDT
Modified files:
/pearweb/public_html captcha-image.php
Log:
* Use mt_rand for choosing what color to use for the arcs in order to
reduce predictability.
* Make arc width even more variable.
http://cvs.php.net/diff.php/pearweb/public_html/captcha-image.php?r1=1.3&r2=1.4&ty=u
Index: pearweb/public_html/captcha-image.php
diff -u pearweb/public_html/captcha-image.php:1.3 pearweb/public_html/captcha-image.php:1.4
--- pearweb/public_html/captcha-image.php:1.3 Fri Aug 13 18:33:42 2004
+++ pearweb/public_html/captcha-image.php Sat Aug 14 19:06:05 2004
@@ -45,7 +45,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright Copyright (c) 2004 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: captcha-image.php,v 1.3 2004/08/13 22:33:42 danielc Exp $
+ * @version $Id: captcha-image.php,v 1.4 2004/08/14 23:06:05 danielc Exp $
*/
if (!isset($_SESSION['captcha'])) {
@@ -191,7 +191,8 @@
$half_w = $image_width / 2;
$center_x = mt_rand($half_w - $arc_pad_min, $half_w + $arc_pad_min);
- $width = ($half_w - abs($half_w - $center_x)) * 2 - $arc_pad_min;
+ $tmp_w = ($half_w - abs($half_w - $center_x)) * 2;
+ $width = mt_rand($tmp_w - $arc_pad_min, $tmp_w - $arc_pad_max);
$center_y = mt_rand($image_height / 2, $image_height - $arc_pad_min);
$height = mt_rand(3, $center_y * 2 - $arc_pad_min);
@@ -204,7 +205,7 @@
}
imagearc($im, $center_x, $center_y, $width, $height,
- $start, $end, $colors[$i % $color_max]);
+ $start, $end, $colors[mt_rand(0, $color_max)]);
}
/*