I have got a piece of .php to create a captcha for a contact form. The captcha generates fine when I test it on my local xampp testing server. However now that I have upload the site to my remote server the captcha only generates the background but no verification code. I just can't figure out why. Here is the php below
<?php
session_start();
header("Expires: Tue, 01 Jan 2013 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < 5; $i++)
{
$randomString .= $chars[rand(0, strlen($chars)-1)];
}
$_SESSION['captcha'] = strtolower( $randomString );
$im = @imagecreatefrompng("captcha-background.png");
imagettftext($im, 20, 5, 10, 30, imagecolorallocate ($im, 0, 0, 0), 'larabiefont.ttf', $randomString);
header ('Content-type: image/png');
imagepng($im, NULL, 0);
imagedestroy($im);
?>