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 5839709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:37:27+00:00 2026-05-22T11:37:27+00:00

Is there a numeric captcha available for PHP ? ( which doesn’t rely on

  • 0

Is there a numeric captcha available for PHP?

(which doesn’t rely on JavaScript being turned on)


EDIT:

  • I know there are JS-independent
    captchas out there.
  • I know there
    are PHP captchas out there.
  • I know
    there are numeric captchas out there.

But I’m looking for a PHP numeric Javascript-independent captcha.
The only numeric captcha’s I’ve found are either for ASP.NET or jQuery/JS based ones.
I don’t want any of those as an answer to the question.

And I’m not taking about a small website here. In the answer I’d like to know whether your suggestion puts a lot of strain on the server or not.

  • 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-22T11:37:28+00:00Added an answer on May 22, 2026 at 11:37 am

    I guess it can’t be avoided to deal with rendering an image when dealing with captchas?
    Here’s a simple one (and may not be the most elegant):

    sample output

    session_start();
    
    $strings = '123456789';
    $i = 0;
    $characters = 6;
    $code = '';
    while ($i < $characters)
    { 
        $code .= substr($strings, mt_rand(0, strlen($strings)-1), 1);
        $i++;
    } 
    
    $_SESSION['captcha'] = $code;
    
    //generate image
    $im = imagecreatetruecolor(124, 40);
    $foreground = imagecolorallocate($im, 0, 0, 0);
    $shadow = imagecolorallocate($im, 173, 172, 168);
    $background = imagecolorallocate($im, 255, 255, 255);
    
    imagefilledrectangle($im, 0, 0, 200, 200, $background);
    
    // use your own font!
    $font = 'monofont.ttf';
    
    //draw text:
    imagettftext($im, 35, 0, 9, 28, $shadow, $font, $code);
    imagettftext($im, 35, 0, 2, 32, $foreground, $font, $code);     
    
    // prevent client side  caching
    header("Expires: Wed, 1 Jan 1997 00:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    
    //send image to browser
    header ("Content-type: image/png");
    imagepng($im);
    imagedestroy($im);
    

    Display it in a form:

    <img src="captcha.php">
    Enter the code above: <input type="text" name="captcha">
    

    Once submitted, check the entered code:

    if ($_POST['captcha'] == $_SESSION['captcha'])
        // do your thing
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that ES_NUMBER exists to limit CreateWindowEx to numeric input only, is there
I would like to know if there is a function in .NET which converts
Is there a encoding function in PHP which will encode strings and the resulting
On my Android App there is a EditText which is supposed to keep numeric
Is there any way I can specify a standard or custom numeric format string
Is there any way where I can check if the field is numeric in
Is there any chance that a SHA-1 hash can be purely numeric, or does
Is there a way in android to invoke a numeric only keypad, i.e. a
In the application there is a dialog where only numeric string entries are valid.
There are two popular closure styles in javascript. The first I call anonymous constructor

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.