Title: Undefined variable: characters_on_image in captcha_code_file.php
Last modified: August 22, 2016

---

# Undefined variable: characters_on_image in captcha_code_file.php

 *  [dave141026](https://wordpress.org/support/users/dave141026/)
 * (@dave141026)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/undefined-variable-characters_on_image-in-captcha_code_filephp/)
 * The line `while ($i < $characters_on_image)` means $characters_on_image should
   exist. But if not isset($_SESSION[‘total_no_of_characters’])), it does not, generating
   a warning in the error log and with some (badly configured servers) in the output
   as well.
 * Please specify what to do when the session is not set, for instance when cookies
   are disabled. One of these would do:
 *     ```
       if(isset($_SESSION['total_no_of_characters']))
           $characters_on_image = $_SESSION['total_no_of_characters'];
       else die('No session');
       ```
   
 *     ```
       if(isset($_SESSION['total_no_of_characters']))
           $characters_on_image = $_SESSION['total_no_of_characters'];
       else $characters_on_image = 0;
       ```
   
 * [https://wordpress.org/plugins/captcha-code-authentication/](https://wordpress.org/plugins/captcha-code-authentication/)

The topic ‘Undefined variable: characters_on_image in captcha_code_file.php’ is 
closed to new replies.

 * ![](https://ps.w.org/captcha-code-authentication/assets/icon-256x256.png?rev=
   3013521)
 * [Captcha Code](https://wordpress.org/plugins/captcha-code-authentication/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/captcha-code-authentication/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/captcha-code-authentication/)
 * [Active Topics](https://wordpress.org/support/plugin/captcha-code-authentication/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/captcha-code-authentication/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/captcha-code-authentication/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [dave141026](https://wordpress.org/support/users/dave141026/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/undefined-variable-characters_on_image-in-captcha_code_filephp/)
 * Status: not resolved