Hallo liebe Community,
ich habe mich grade schnell an einem Capatcha versucht, bin aber gescheitert.
Folgendes Problem: Das Bild wird als Link dargestellt, also der Dateipfad ist der Bildinhalt.
PHP-Code:
<?php
session_start();
//Capatcha erstellen
function security($sec_laenge)
{
header('Content-Type: image/jpeg');
$fonta["1"] = "schrift/1.tft";
$fonta["2"] = "schrift/2.tft";
$fonta["3"] = "schrift/3.tft";
$zeichen = "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789";
$nowzeichen = "";
$security = "";
$img = imagecreatetruecolor("180", "70");
$color = imagecolorallocate($img, rand(190, 255), rand(190, 255), rand(190, 255));
imagefill($img, 0, 0, $color);
$font = rand(1, 3);
$font = $fonta[$font];
mt_srand ((double) microtime() * 10000);
for ($now = 0; $now < $sec_laenge; $now++ )
{
$nowzeichen = $zeichen{mt_rand (0,strlen($zeichen))};
$security .= $nowzeichen;
$color = imagecolorallocate($img, rand(0, 199), rand(0, 199), rand(0, 199));
$x = 23;
$y = 25 + rand(0, 10);
$kipp = rand(0, 30);
imagettftext($img, "9", $kipp, $x, $y, $color, $font, $nowzeichen);
}
$_SESSION['security'] = $security;
imagejpeg($img);
}
security("1");
?>
Sehe ich etwa den Wald vor lauter Bäumen nicht oder ist es dann doch ehr ein komplizhierteres Problem?
Schönen Gruß.