Ik heb een Captcha en dat wil ik aan mijn formulier koppelen.
Als ik de code intikt in het formulier dan wordt die niet als goed gezien.
Ik zie iets over het hooft maar ik weet niet wat.
wie kan mij helpen???
Formulier
Captcha
Ariën
Als ik de code intikt in het formulier dan wordt die niet als goed gezien.
Ik zie iets over het hooft maar ik weet niet wat.
wie kan mij helpen???
Formulier
PHP:
<?php ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Contact formulier</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Contact Formulier</h1>
<br/><hr/>
<p>Invoervelden met een <img src="gif/icon_star-1.gif" alt="Met een Ster is een verplicht invoerveld!" width="15" height="15" border="0" /> zijn verplichte invoervelden.<br />
Typ onderaan van het formulier de "Verificatiecode" over in het lege invoerveld daarnaast om te laten zien dat u geen Spam Robot bent.</p>
<form method="post" class="formulier" enctype="multipart/form-data" action="antwoord.php">
<?php
if(isset($errors) && count($errors)) {
foreach($errors as $value) {
?>
<div class="formuliererror"><?
print "$value<br />";
}
?></div><?
}
?>
<p>
<label for="voornaam">Voornaam :</label>
<input type="text" id="voornaam" name="voornaam" value="<?=$_REQUEST["voornaam"]?>" />
<img src="gif/icon_star-1.gif" alt="Met een Ster is een verplicht invoerveld!" width="10" height="10" border="0" /></p>
<p>
<label for="achternaam">Achternaam :</label>
<input type="text" id="achternaam" name="achternaam" value="<?=$_REQUEST["achternaam"]?>" />
<img src="gif/icon_star-1.gif" alt="Met een Ster is een verplicht invoerveld!" width="10" height="10" border="0" /></p>
<p>
<label for="adres">Adres :</label>
<input type="text" id="adres" name="adres" value="<?=$_REQUEST["adres"]?>" /> Optie</p>
<p>
<label for="postcode">Postcode :</label>
<input type="text" id="postcode" name="postcode" value="<?=$_REQUEST["postcode"]?>" /> Optie</p>
<p>
<label for="woonplaats">Woonplaats :</label>
<input type="text" id="woonplaats" name="woonplaats" value="<?=$_REQUEST["woonplaats"]?>" /> Optie</p>
<p>
<label for="telefoon">Telefoon :</label>
<input type="text" id="telefoon" name="telefoon" value="<?=$_REQUEST["telefoon"]?>" /> Optie</p>
<p>
<label for="email">E-mail :</label>
<input type="text" id="email" name="email" value="<?=$_REQUEST["email"]?>" />
<img src="gif/icon_star-1.gif" alt="Met een Ster is een verplicht invoerveld!" width="10" height="10" border="0" /></p>
<p>
<label for="url">URL :</label>
<input type="text" id="url" name="url" value="<?=empty($_REQUEST["url"]) ? 'http://' : $_REQUEST["url"]?>" /> Optie</p>
<p>
<label for="onderwerp">Onderwerp :</label>
<input type="text" id="onderwerp" name="onderwerp" value="<?=$_REQUEST["onderwerp"]?>" />
<img src="gif/icon_star-1.gif" alt="Met een Ster is een verplicht invoerveld!" width="10" height="10" border="0" /></p>
<p>
<label for="bericht">Uw bericht : <img src="gif/icon_star-1.gif" alt="Met een Ster is een verplicht invoerveld!" width="10" height="10" border="0" /></label>
<textarea id="bericht" name="bericht" rows="5" cols="25"><?=$_REQUEST["bericht"]?></textarea></p>
<p>
<label for="captcha" id="captcha">Verificatie Code :</label>
<img class="captcha" src="captcha.php" alt="Captcha" /></p>
<p>
<label for="securityCode">Typ hier de Code :</label>
<input type="text" tabindex="3" name="securityCode" id="securityCode" value="" size="8" maxlength="8"/>
<img src="gif/icon_star-1.gif" alt="Met een Ster is een verplicht invoerveld!" width="10" height="10" border="0" /></p>
<p>
<label for="contact_email_copy">Kopie van dit bericht :</label>
<input type="checkbox" name="email_copy" id="contact_email_copy" value="1" /> E-mail een kopie naar uw eigen e-mailadres</p>
<div style="margin-left: 150px;">
<input type="submit" value="Verstuur" class="formulierbutton"/>
<input type="reset" value="Wissen" class="formulierbutton"/>
</div>
</form>
</div>
</html>
Captcha
PHP:
<?php
session_start();
$width = 140;
$height = 35;
$im = imagecreate($width, $height);
$bg = imagecolorallocate($im, 0, 0, 0);
// generate random string
$len = 5;
$chars = 'ABCDEFGHJKMNPQRSTUVWXYZabcdefghjkmnpqrstuvw23456789';
$string = array();
for ( $i = 0; $i < $len; $i++ ) {
$pos = rand ( 0, strlen ( $chars ) - 1 );
$string[$i] = $chars{$pos};
}
$string2 = implode ( '', $string );
$_SESSION["securityCode"] = md5($string2);
// grid groen
$grid_color = imagecolorallocate($im, 0, 175, 0);
$number_to_loop = ceil($width / 20);
for($i = 0; $i < $number_to_loop; $i++) {
$x = ($i + 1) * 20;
imageline($im, $x, 0, $x, $height, $grid_color);
}
$number_to_loop = ceil($height / 10);
for($i = 0; $i < $number_to_loop; $i++) {
$y = ($i + 1) * 10;
imageline($im, 0, $y, $width, $y, $grid_color);
}
// grit rood
$extra_color = imagecolorallocate($im, 175, 0, 0);
$number_to_loop = ceil($width / 15);
for($i = 0; $i < $number_to_loop; $i++) {
$x = ($i + 1) * 15;
imageline($im, $x, 0, $x, $height, $extra_color);
}
$number_to_loop = ceil($height / 20);
for($i = 0; $i < $number_to_loop; $i++) {
$y = ($i + 1) * 20;
imageline($im, 0, $y, $width, $y, $extra_color);
}
// grit blouw
$extra2_color = imagecolorallocate($im, 0, 0, 255);
$number_to_loop = ceil($width / 25);
for($i = 0; $i < $number_to_loop; $i++) {
$x = ($i + 1) * 25;
imageline($im, $x, 0, $x, $height, $extra2_color);
}
$number_to_loop = ceil($height / 15);
for($i = 0; $i < $number_to_loop; $i++) {
$y = ($i + 1) * 15;
imageline($im, 0, $y, $width, $y, $extra2_color);
}
// random lines groen
$line_color = imagecolorallocate($im, 0, 130, 0);
for($i = 0; $i < 10; $i++) {
$rand_x_1 = rand(0, $width - 1);
$rand_x_2 = rand(0, $width - 1);
$rand_y_1 = rand(0, $height - 1);
$rand_y_2 = rand(0, $height - 1);
imageline($im, $rand_x_1, $rand_y_1, $rand_x_2, $rand_y_2, $line_color);
}
// random lines rood
$line2_color = imagecolorallocate($im, 130, 0, 0);
for($i = 0; $i < 10; $i++) {
$rand_x_1 = rand(0, $width - 1);
$rand_x_2 = rand(0, $width - 1);
$rand_y_1 = rand(0, $height - 1);
$rand_y_2 = rand(0, $height - 1);
imageline($im, $rand_x_1, $rand_y_1, $rand_x_2, $rand_y_2, $line2_color);
}
// random lines blouw
$line3_color = imagecolorallocate($im, 0, 0, 130);
for($i = 0; $i < 10; $i++) {
$rand_x_1 = rand(0, $width - 1);
$rand_x_2 = rand(0, $width - 1);
$rand_y_1 = rand(0, $height - 1);
$rand_y_2 = rand(0, $height - 1);
imageline($im, $rand_x_1, $rand_y_1, $rand_x_2, $rand_y_2, $line3_color);
}
// write the text
$i=0;
while($i < $len){
$kleur1 = rand(150, 255);
$kleur2 = rand(150, 255);
$kleur3 = rand(150, 255);
$text_color = imagecolorallocate($im, $kleur1, $kleur2, $kleur3);
$rand_x = rand($width/6*$i+15, $width/6*$i+15);
$rand_y = rand(0, $height - 15);
imagestring($im, 10, $rand_x, $rand_y, $string[$i], $text_color);
$i++;
}
header ("content-type: image/png");
imagepng($im);
?>
Ariën