captcha error


Posted on 16th Feb 2014 07:03 pm by admin

I have been trying to implement a captcha in php...

here is the code..
Code: (php) [Select]<?php
// Set the content-type
header('Content-type: image/png');

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>

But in the browser, it gives the following error...
QuoteThe image “http://127.0.0.1:9000/img1.php” cannot be displayed, because it contains errors.
Somebody tell me the reason and how to fix this ..

No comments posted yet

Your Answer:

Login to answer
158 Like 26 Dislike
Previous forums Next forums
Other forums

Wordpress IE issue
So I am trying to add the background shadow to my wordpress page. It works fine in Firefox but does

Curl & sessions PLS HELP
Hello,

I have a problem with curl and sessions and i will try to explain the best i could.

Limiting uploaded file type
Hi. First post here
I am working on a simple upload script, and I need it to limit the allowed f

mysql query with single quotes in a variable
$sitedetails = "INSERT INTO vars (address, sitename, description, ownername, theme) VALUES ('$u

Clean URLs
Hi I was wandering if anyone has ever implemented URLs on their PHP run website using URLS like wiki

question about header() security
is is safe to just use the header() function to redirect someone if they are, say, not logged in? or

Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but e

SAP Treasury - Commodities
We are running SAP ECC 6.0 with Treasury Activated.
EA-FIN is also activated (SFW5).

button.click += new eventhandler() not works in if(!ispostback)
i want to use button.clcik event in function VIewScrap() which is called in if(!ispostback) but itdo

Problem assigning value to variable in "IF" function
Does this script makes sense? I am trying to take the value that is set to "authenticat" a

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash