Need some help with a bit of code.

Okay so I had this captcha code and it worked for a long time then one day it stopped working. Basically what i am trying to achieve is this. When a user visits our page and wants to contact us they can send us some info using a form. There is captch on this form and it uses php to make the captcha image and to email the data to my email. Problem is the image is not showing up.
here is the html for the form [code]

Business Solutions
			<li><a href="support.html">Support</a></li>
			<li><a href="promo.html">Promotions</a></li>
			<li class="selected"><a href="contact.html">Contact Us </a></li>
</div> <!-- /#header -->
<div id="contents">
	<div class="background">
		<div id="contacts">
						<b>Advantage Computer Solutions </b>
						349 Cypress Ave. Orange City, FL 32763 <br/>
						Tel: 386 - 785 - 1277 <br/>
						Toll Free: 877 - <br/>
					  Email: [email protected]</p>
			      <form name="form1" action="captchaform/captcha.php" method="post">
			        <input type="text" name="name" id="name">
                                          <input type="text" name="phone" id="phone">
                                          <input type="text" name="emailaddress" id="emailaddress">
                                          <textarea name="comment" id="comment" cols="40" rows="5"></textarea>
                                        <p>Please enter the security code you see below.                                               </p>
                                        <p><img src="captcha_image.php"></p>
                                          <input type="text" name="security" id="security">
                                          <input type="submit" name="submit" id="submit" value="Submit">
</div> <!-- /#contents -->
<div id="footer">
	<ul class="contacts">
		<h3>Contact Us</h3>
		<p>: [email protected] </p>
		<p>: 349 Cypress Ave. Orange City, FL 32763 </p>
		<p>: 386-785-1277 </p>
	<ul id="connect">
		<h3>Get Updated</h3>
		<li><a href="blog.html">Blog</a></li>
		<li><a href="" target="_blank">Facebook</a></li>
		<li><a href="" target="_blank">Twitter</a></li>
	<span class="footnote">&copy; Copyright &copy; 2011. All rights reserved</span>
</div> <!-- /#footer -->

this is the captcha.php file
// *** The CAPTCHA comparison - ***
// *** further modifications - ***


// *** We need to make sure theyre coming from a posted form -
// If not, quit now ***
die(“You can only reach this page by posting from the html form”);

// *** The text input will come in through the variable $_POST[“captcha_input”],
// while the correct answer is stored in the cookie $_COOKIE[“pass”] ***
if ($_POST[“security”] == $_SESSION[“pass”])
// *** They passed the test! ***
// *** This is where you would post a comment to your database, etc ***
echo "Correct! You have passed the captcha test.

echo "You information input has been sent


   echo "This is what you sent  <br><br>";

    echo "Name: \"" . $_POST["name"] . "\" <br>";

   echo "Phone: \"" . $_POST["phone"] . "\" <br>";

    echo "Home Phone: \"" . $_POST["Homephone"] . "\" <br>";

	echo "Email Address: \"" . $_POST["emailaddress"] . "\" <br>";
	echo "Your Comment: \"" . $_POST["comment"] . "\" <br>";

//sends email via php to the following address
$mailuser = "[email protected]";

//echo 'default chosen address: '.$mailuser;

$header = "Return-Path: ".$mailuser."\r\n"; 
$header .= "From: form with captcha <".$mailuser.">\r\n"; 
$header .= "Content-Type: text/html;"; 
$mail_body = '
Name: '.$_POST[name].' has sent his input.
Phone: '. $_POST[phone] . '<br>
Email Address: '. $_POST[emailaddress] . '<br>
Your Comment: '. $_POST[comment] . '<br>'
mail ($mailuser, 'Form sent', $mail_body, $header);
     echo 'THANKS ';    

} else {
// *** The input text did not match the stored text, so they failed ***
// *** You would probably not want to include the correct answer, but
// unless someone is trying on purpose to circumvent you specifically,
// its not a big deal. If someone is trying to circumvent you, then
// you should probably use a more secure way besides storing the
// info in a cookie that always has the same name! :slight_smile: ***
echo “Sorry, you did not pass the CAPTCHA test.

echo "You said " . $_POST[“captcha_input”];
echo " while the correct answer was " . $_SESSION[“pass”];

    echo "    - Please click back in your browser and try again <br><br>";


This is the captcha img file
// *** CAPTCHA image generation ***
// *** ***


// *** Tell the browser what kind of file is come’n at 'em! ***
header(“Content-Type: image/jpeg”);

// *** Send a generated image to the browser ***

// *** Function List ***
function create_image()
// *** Generate a passcode using md5
// (it will be all lowercase hex letters and numbers ***
$md5 = md5(rand(0,9999));
$pass = substr($md5, 10, 5);

// *** Set the session cookie so we know what the passcode is ***
$_SESSION["pass"] = $pass;

// *** Create the image resource ***
$image = ImageCreatetruecolor(100, 20);

// *** We are making two colors, white and black ***
$clr_white = ImageColorAllocate($image, 255, 255, 255);
$clr_black = ImageColorAllocate($image, 0, 0, 0);

// *** Make the background black ***
imagefill($image, 0, 0, $clr_black);

// *** Set the image height and width ***

// *** Add the passcode in white to the image ***
imagestring($image, 5, 30, 3, $pass, $clr_white);

// *** Throw in some lines to trick those cheeky bots! ***
imageline($image, 5, 1, 50, 20, $clr_white);
imageline($image, 60, 1, 96, 20, $clr_white);

// *** Return the newly created image in jpeg format ***
return imagejpeg($image);

// *** Just in case... ***


Could someone please tell me why my image is not showing up? Thanks!

It worked but now it doesnt. Can anyone tell me what is going on. This is the website Thanks!

Sponsor our Newsletter | Privacy Policy | Terms of Service