Ich weis zwar nicht ob du das Problem schon gelöst hast aber so sollte es gehen. Die User Abfrage kannst du selbst bauen.
Code:
<?php
header ('Content-type: image/png');
/**
* @name create_text
* @desc create a random text
* @param int split count
* @param int length of a split
* @param string sepperator
* @return string
*/
function create_text( $param , $param2 , $param3)
{
$temp[0] = 'abcdefghijklmnopyrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ1234567890';
for ( $x=1; $x <= $param ; $x++ )
{
for ( $y=1; $y <= $param2 ; $y++ )
{
$temp[1] .= $temp[0][ rand( 0 , strlen( $temp[0] ) ) ];
}
$temp[1] .= ( $x != $param ) ? $param3 : '';
}
return $temp[1];
}
// Temporärer string
$temp = create_text( 4 , 5 , ' - ' );
// Globale Variable update
$_SESSION['crackcode'] = $temp;
// Bild erstellen
$img = @imagecreatetruecolor(600, 100)
or die('Cannot Initialize new GD image stream');
// Bild gestalltung
$bg = imagecolorallocate( $img , 52, 100, 192 );
imagefill( $img, 0, 0, $bg );
// Schrifft gestallten
$text_color = imagecolorallocate( $img , 255 , 255 , 255 );
imagestring( $img , 16, 150, 40, $temp , $text_color);
//Ausgabe / Löschen
imagepng( $img );
imagedestroy( $img );
?>