开发者

Captcha Code Case Sensitiveness in Codeigniter

开发者 https://www.devze.com 2023-02-20 18:38 出处:网络
How to Set Cap开发者_运维知识库tcha Code in Uppercase. Are their any more help for captcha other than codeigniter.To create a captcha with uppercase characters you\'d need to do something like this:

How to Set Cap开发者_运维知识库tcha Code in Uppercase. Are their any more help for captcha other than codeigniter.


To create a captcha with uppercase characters you'd need to do something like this:

$vals = array(
    'word' => strtoupper('Random word'), // Here is where the captcha code is converted to uppercase
    'img_path' => './captcha/',
    'img_url' => 'http://example.com/captcha/',
    'font_path' => './path/to/fonts/texb.ttf',
    'img_width' => '150',
    'img_height' => 30,
    'expiration' => 7200
    );

$cap = create_captcha($vals);
echo $cap['image'];

Of course you may need to check SQL when checking and make it look into checking for the uppercase version of your random word in the database.


One method is to change Collation of captcha word field in captcha table to latin1_general_cs .


The really easy fix/work-around is to use a font that is all caps.

You can find such a font from http://www.myfonts.com and pay a few dollars for a web license and get a font that you like.

Search for "all caps" or similar.

Alternatively, you can search the web and find a free font.

This is easier than trying to hack into the CodeIgniter CAPTCHA Helper.

0

精彩评论

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

关注公众号