How to generate Codeigniter-2 as meaning word instead of code?
I figured out that codeigniter-2 by default can only generate captcha in alphanumeric . How can I expand it to generate as a meaningful word ?
For example:
-
morning
-
overlooking
- and etc.
Sample code that generates captcha:
$vals = array(
'img_path' => './assets/captcha/',
'img_url' => 'http://url/assets/captcha/',
'img_width' => '130',
'font_path' => './assets/fonts/Moms_typewriter.ttf',
'img_height' => '33',
'expiration' => CAPTCHA_MAX_TIME_EXPIRATION
);
$cap = create_captcha($vals);
+3
source to share
1 answer
Just use array
and pass the element with a loop
<?php
$ab = array('Morning','Night','welcome','im here');
$word = '';
$n = 0;
while ($n < 1)
{
$word .= $ab[mt_rand(0,9)];
$n++;
}
$vals = array(
'word' => $word,
'img_path' => './assets/captcha/',
'img_url' => base_url().'assets/captcha/',
'img_width' => '130',
'font_path' => './assets/fonts/Moms_typewriter.ttf',
'img_height' => '33',
'expiration' => CAPTCHA_MAX_TIME_EXPIRATION
);
+2
source to share