Hallo,
es geht um die Captcha Library.
Ich würde es gerne so einrichten, dass ich über einen Button das erzeugte Captcha neu erstellen lassen kann, wenn eine nicht lesbare Variante erzeugt worden ist.
Dazu habe ich folgenden Code in mein mailforplus-template mit aufgenommen:
<input type="button" value="Neues captcha" onclick="var heute = new Date(); document.getElementById('captcha img').src='typo3conf/ext/captcha/captcha/captcha.php?'+heute.getTime()" />
Nun wird ja via den Platzhalter ###CAPTCHA### in mailformPlus im Frontend folgendes ausgegben:
<img src="typo3conf/ext/captcha/captcha/captcha.php" alt="" />
Nach der obigen JavaScript Anweisung müsste dem captch img noch die id"captcha" zugewiesen werden.
Das captch-img wird ja durch die Datei "captcha.php" der Extension Captcha Library erzeugt:
<?php
/***************************************************************************
*
* Filename : image.php
* Began : 2005/04/04
* Modified :
* Copyright : (c) 2005 xkare.com
* Version : 1.0
* Written by : Mert ���T in istanbul / TURKEY
*
* You are encouraged to redistribute and / or modify this program under the terms of
* the GNU General Public License as published by the Free Software Foundation
* (www.fsf.org); any version as from version 2 of the License.
*
***************************************************************************/
session_start();
function strrand($length)
{
$str = "";
while(strlen($str)<$length){
$random=rand(48,122);
#if( ($random>47 && $random<58-) ){
if (ereg('[A-Za-z]',chr($random)))
$str.=chr($random);
#}
}
return $str;
}
$imgHeight = 34;
$imgWidth = 110;
$text = $_SESSION['tx_captcha_string'] = strrand(5);
$img_number = imagecreate($imgWidth,$imgHeight);
$backcolor = imagecolorallocate($img_number,240,240,240);
$textcolor = imagecolorallocate($img_number,100,100,100);
$white = imagecolorallocate($img_number, 0xFF, 0xFF, 0xFF);
imagefill($img_number,0,200,$backcolor);
// Imagestring($img_number,5,1,1,$text,$textcolor);
// neu start
$font = dirname($_SERVER["SCRIPT_FILENAME"])."/CA_GEHEIM_TRASH.TTF";
imagettftext($img_number, 24, 3, 36, 25, $textcolor, $font, $text);
// neu ende
//some obfuscation
for ($i=0; $i<3; i="" x1="" imgwidth="" -="" 1="" y1="" roundimgheight="" 10="" x2="" roundimgwidth="" y2="" imgheight="" imagelineimg_number="" white="" rand1="" cx="" 50="" 25="" cy="" w="" 24="" imagearcimg_number="" 360="" headercontent-type:="" imagepng="" imagepngimg_number="">
Wo und wie kann ich hier die id="captcha" für das FE einfügen?
Bin selbst des PHPs nicht mächtig und würde mich über Hilfe freuen.
Dank im Vorraus
Sukkulent