Hello here is my last help.
Sry if i write mistakes im from germany i cant good speak/write English.
Here is my question:
My sript doesn´t work:
<form method="post" action="formular2.php">
<p>Ihr Name:
<input type="text" name="name">
<br>
Ihre Nachricht:
<textarea name="nachricht"></textarea>
</p>
<p><img src="rechen-captcha.php"> <input type="text" name="sicherheitscode" size="5"><br>
<input type="submit" name="Button" value="Abschicken">
</p>
</form>
<?PHP
echo "Ihre Nachricht wurde mit diesem Inhalt gesendet:<br>";
echo "Ihr Name: $_POST[name]<br>";
echo "Ihre Nachricht $_POST[nachricht]";
mail("user@user.com","Nachricht von $_POST[name]",$_POST[nachricht]);
?>
<?php
session_start();
unset($_SESSION['rechen_captcha_spam']);
$zahl1 = rand(10,20); //Erste Zahl 10-20
$zahl2 = rand(1,10); //Zweite Zahl 1-10
$operator = rand(1,2); // + oder -
if($operator == "1"){
$operatorzeichen = " + ";
$ergebnis = $zahl1 + $zahl2;
}else{
$operatorzeichen = " - ";
$ergebnis = $zahl1 - $zahl2;
}
function encrypt($string, $key) {
$result = '';
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)+ord($keychar));
$result.=$char;
}
return base64_encode($result);
}
$_SESSION['rechen_captcha_spam'] = encrypt($ergebnis, "29jfkd921"); //Key
$_SESSION['rechen_captcha_spam'] = str_replace("=", "", $_SESSION['rechen_captcha_spam']);
$rechnung = $zahl1.$operatorzeichen.$zahl2." = ?";
$img = imagecreatetruecolor(80,15);
$schriftfarbe = imagecolorallocate($img,13,28,91);
$hintergrund = imagecolorallocate($img,162,162,162);
imagefill($img,0,0,$hintergrund);
imagestring($img, 3, 2, 0, $rechnung, $schriftfarbe);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>
Can anyone help me the captcha code didn´t want to work....
Can anyone help me or give me a better code...?
The Captcha Code is for a Formular.
bgmclan