Jump to content

In this script captcha image isn't displaying pls guide me to find the problem.

Recommended Posts

//captcha.php script <?phpsession_start();$text = rand(10000,99999);$_SESSION["vercode"] = $text;$height = 25;$width = 65; $image_p = imagecreate($width, $height);$black = imagecolorallocate($image_p, 0, 0, 0);$white = imagecolorallocate($image_p, 255, 255, 255);$font_size = 14; imagestring($image_p, $font_size, 5, 5, $text, $white);imagejpeg($image_p, null, 80);?> //html form script <body><form id="form1" name="form1" method="post" action=""><table width="500" border="0"><tr><td>Verify Code </td><td><img src="captcha.php" /></td><td><input type="text" name="verifycode" /></td></tr><tr><td colspan="3"><input type="submit" name="submit" value="submit" /></td></tr></table></form></body>

Link to post
Share on other sites

you need to set proper ontent type header before any ouput is produed to browserheader("Content-type:image/jpg");

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...