The whole idea is to create a form that makes a image in the php and then you have a confirmation page to send it as an email.
It works on my web hosting service , but it fails to work on my computer with easyPHP in mind. It does nothing , the complete image stays on the screen and does not redirect.
<?php
header( "Content-type: image/png" );
ob_start();
if(!isset($_POST['name']) ||
!isset($_POST['birth']) ||
!isset($_POST['date']) ||
!isset($_POST['asiakasnumero']))
{
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$name = $_POST['name']; // required
$birth = $_POST['birth']; // required
$date = $_POST['date']; // required
$asiakasnumero = $_POST['asiakasnumero']; // required
$my_img = @imagecreatefrompng('card.png');
$text_colour = imagecolorallocate( $my_img, 255, 255, 255 );
imagestring( $my_img, 3, 240, 155, $name,
$text_colour );
imagestring( $my_img, 3, 240, 215, $birth,
$text_colour );
imagestring( $my_img, 3, 240, 273, $date,
$text_colour );
imagestring( $my_img, 3, 140, 327, $asiakasnumero,
$text_colour );
$image_path = "images/card".".png";
imagesetthickness ( $my_img, 5 );
imagepng( $my_img );
imagecolordeallocate($my_img , $text_colour );
imagepng($my_img, $image_path);
imagedestroy( $my_img );
ob_end_flush();
sleep(5);//seconds to wait..
header('HTTP/1.1 301 Moved Permanently'); //optional
header("Location: http://www.domain.com");
exit();
?>
I have tried to use .htaccess in order to redirect it but htaccess does not allow the function to do its thing. I also tried combining the image create script with the confirmation page but in vain...
Thanks!