开发者

Not able to change the size of captcha in PHP

I have the following captcha plug-in.

I tried changing different font-size but none of them worked.

Could anyone tell me how to change the font-size please.

Thanks in advance.

EDITED: C开发者_开发技巧ode Here.


This captcha is garbage and this code is poorly written. You should use reCapthca, it is very good and its free.

I have the right to say that that this capthca is garbage because I break capthcas: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-2019 http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-3573 http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-2020 http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2008-3573 (Or atleast in 2008 I did :)

But to actually answer your question: On line 127 the length of the challenge is being generated. Change the number 6 to whatever you want.

    for ($i = 0; $i < 6; $i++)
    {
        $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
    }


Change the font size in this piece of code, and enter higher values for the call to mt_rand.

if ($use_font == FALSE)
{
    //$font_size = 5;
    $font_size = 15;//For example
    $x = rand(2, $img_width/($length/3));
    // y isnt used here
}
else
{
    // Make font proportional to the image size
   // $font_size  = !empty($font_size) ? $font_size : mt_rand(18,25);
      $font_size  = !empty($font_size) ? $font_size : mt_rand(25,29);//For example
    $x = rand(4, $img_width - (($font_size + ($font_size >> 1)) * $length));
    // y isnt used here
}

Also make sure the $img_width and the $img_height are big enough so larger fonts will fit in the image.


You may want to try to write under that:

$defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_size' => '', 'font_path' => '', 'show_grid' => true, 'skew' => true, 'expiration' => 7200);

the following line

$defaults['font_size'] = 0;

(and change the 0 to your desired size of course)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜