Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4014942
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:33:29+00:00 2026-05-20T09:33:29+00:00

this is some form generation code. I would like to add a captcha or

  • 0

this is some form generation code. I would like to add a captcha or math verify. I have a captcha class construct file called captcha.php. I have used this class on more basic php forms ive written but the following was written by someone else. I was thinking I could either add another case called captcha or make a smartforms_captcha function. Any ideas?

function smartforms_form_field($type,$name,$class = '',$extra = array(),$prefill = true) {
    global $sf_form,$sf_fid;

    if (!empty($extra) && !is_array($extra)) parse_str($extra,$extra);
    $classes = array('input_' . $type, $sf_form->field[$sf_fid][$name]);
    if (!is_array($class)) $class = preg_split('#\s+#',$class);
    $classes = trim(implode(' ',array_merge($classes,$class)));

    $value = ($prefill) ? $sf_form->values[$sf_fid][$name] : '';
    switch ($type) {
        case 'text':
        $autocomplete = ($extra['autocomplete'] == 'off') ? 'off' : 'on';
        $format = '<input type="text" name="%1$s" id="%1$s" class="%2$s" value="%3$s" autocomplete="%4$s" />';
        printf($format,$name,$classes,$value,$autocomplete);
        break;
        case 'textarea':
        $rows = $extra['rows'];
        $cols = $extra['cols'];
        $format = '<textarea name="%1$s" id="%1$s" class="%2$s" rows="%3$d" cols="%4$d">%5$s</textarea>';
        printf($format,$name,$classes,$rows,$cols,$value);
        break;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:33:30+00:00Added an answer on May 20, 2026 at 9:33 am

    I implemented an image captcha class which is some what secure as well… you can download and use the code and also if you find any interesting changes do let me know:

    http://phphelperfunctions.blogspot.com/2010/09/ultimate-security-for-image-captcha-php.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a plain text file looking like this: some text containing line breaks
Has anyone done this / have some example code?
I have a class that generates some html (form elements and table elements), but
This is a bit special: I'm loading some HTML in string form into the
I am trying to hide some divs before the user prints this giant form,
In this thread some one commented that the following code should only be used
I have this in some WSDL: <element name="startDate" type="xsd:dateTime"/> <element name="endDate" type="xsd:dateTime"/> Which results
I just found this in some old code, and I'm not sure what it
I recently came across this in some code - basically someone trying to create
I have a Java Applet that is generating an image. Ultimately, I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.