Undefined variable: characters_on_image in captcha_code_file.php
-
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;
The topic ‘Undefined variable: characters_on_image in captcha_code_file.php’ is closed to new replies.