Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Additional options for captcha_helper #51

Closed
bitbucket-import opened this Issue Aug 19, 2011 · 8 comments

Comments

Projects
None yet
5 participants

I suggest add additional options to CAPTCHA:

word_len - The length of random word
img_id - ID attribute for image

Code:

$defaults = array('word' => '', **'word_len' => 8**, **'img_id' => 'img_captcha'**, 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 1800);

...

if ($word == '')
{
   $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

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

   $word = $str;
}

...

$img = "<img **id=\"$img_id\"** src=\"$img_url$img_name\" width=\"$img_width\" height=\"$img_height\" style=\"border:0;\" alt=\" \" />";

Use:

$params = array('word_len' => 6, 'img_id' => 'img_captcha' ... );
$cap = create_captcha($params);

derekjones pushed a commit that referenced this issue Aug 19, 2011

Merge pull request #51 from waldmeister/develop
Added some docs to CI core files
Contributor

ckdarby commented Jun 8, 2012

@philsturgeon Is the core captcha helper going to be getting removed eventually with Spark taking over the helper?

sviande pushed a commit to sviande/CodeIgniter that referenced this issue Jan 3, 2014

Merge pull request #51 from waldmeister/develop
Added some docs to CI core files
Contributor

jim-parry commented Nov 11, 2014

The captcha helper has word length at present, and the example shown has a name attribute, & could have an id attribute.
This looks like a dead issue.

Contributor

narfbg commented Nov 11, 2014

Depends on what you mean by "could have". It can't have an ID attribute unless you modify the helper.

Contributor

jim-parry commented Nov 11, 2014

In the helper docs, a sample usage is
[code]
echo 'Submit the word you see below:';
echo $cap['image'];
echo '';
[/code]

which seems to suggest that name or id attributes are handled outside of the helper itself.

Contributor

narfbg commented Nov 11, 2014

Contributor

jim-parry commented Nov 11, 2014

My last comment was incomplete ... the third line of code should have been

echo '<input type="text" name="captcha" value="" />';

I see that the id/name attributes of the text field are outside fo the captcha helper ... do we need an id/name attribute for the img tag itself? Not a big deal to add ... anyone using this?

Contributor

narfbg commented Nov 11, 2014

Indent code with 4 spaces/a tab or wrap it with <pre>.

Contributor

preems commented Nov 12, 2014

I checked the latest code. I neither supports name nor id. But could be easily added.

@jim-parry jim-parry removed the Dead Issue? label Nov 12, 2014

preems added a commit to preems/CodeIgniter that referenced this issue Dec 3, 2014

Closing Issue #51. Added img_id and img_name in capcha helper
Signed-off-by: Preetham <me@preetham.in>

preems added a commit to preems/CodeIgniter that referenced this issue Dec 5, 2014

closing #51. Added img_id and img_name in capcha helper
Signed-off-by: Preetham <me@preetham.in>

@narfbg narfbg closed this in 3c0427e Dec 5, 2014

@ghost ghost pushed a commit to goreilly/CodeIgniter that referenced this issue Jan 3, 2015

closing #51. Added img_id and img_name in capcha helper
Signed-off-by: Preetham <me@preetham.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment