Das heißt es wird einfach das bild nicht erzeugt. Obwohl alles Bibliotheken (GD) isnatlliert sind. ICh habe also an der Standartkonfig von Xammp nichts geändert.
hier der code
captcha.php
- Code: Select all
<?php
session_start();
unset($_SESSION['captcha_spam']);
function randomString($len) {
function make_seed(){
list($usec , $sec) = explode (' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
//Der String $possible enthält alle Zeichen, die verwendet werden sollen
$possible="ABCDEFGHJKLMNPRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789";
$str="";
while(strlen($str)<$len) {
$str.=substr($possible,(rand()%(strlen($possible))),1);
}
return($str);
}
$text = randomString(5); //Die Zahl bestimmt die Anzahl stellen
$_SESSION['captcha_spam'] = $text;
header('Content-type: image/png');
$img = ImageCreateFromPNG('captcha.PNG'); //Backgroundimage
$color = ImageColorAllocate($img, 0, 0, 0); //Farbe
$ttf = $_SERVER['DOCUMENT_ROOT']."/captcha/XFILES.TTF"; //Schriftart
$ttfsize = 25; //Schriftgrösse
$angle = rand(0,5);
$t_x = rand(5,30);
$t_y = 35;
imagettftext($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $text);
imagepng($img);
imagedestroy($img);
?>
index.php
- Code: Select all
<?session_start()?>
<html>
<head><title>sicherheit</title></head>
<body>
<?php
$submit=$_POST['submit'];
if ($submit)
{
#echo $_POST["sicherheitscode"];
if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){
unset($_SESSION['captcha_spam']);
echo "ok!";
}else{
die ("Der Sicherheitscode ist falsch!");
}
}
?>
<form method="post" action="index.php">
<tr>
<td><img src="captcha/captcha.php" border="0" title="Sicherheitscode"></td>
<td><input type="text" name="sicherheitscode" size="5"></td>
<td><input type="submit" name="submit" value="abschicken"></td>
</tr>
</form>
</body>
</html>
gruß niesel