Like others here, I have experienced what I believe to be spam-bots using my contact page to send email.
I have a form on contact.php that when submitted, it's action is a "dothesefunctions.php" and the mail is sent from my host to myself. My email is in the dothesefunctions.php script and is made up of multiple variables that I concattenate together making up my full email address when the script is run.
i have recently had this spam again, apparently sent from the contact form.
to counteract this, I wish to add a jpeg/png/gif that displays a code, that must also be entered when posting the message via the contact form (preventing spambots, and I'll know if someone is being malicious).
I have searched, and all the forums have helped me with is displaying the image.
in a file called image.php i have the following code:
<?php
header ("Content-type: image/png");
$code = rand (1000, 9999);
$font = 7;
$width = ImageFontWidth($font) * strlen($code);
$height = ImageFontHeight($font);
$im = @imagecreate ($width,$height);
$background_color = imagecolorallocate ($im, 200, 200, 0); //white background
$text_color = imagecolorallocate ($im, 0, 0,0);//black text
imagestring ($im, $font, 0, 0, $code, $text_color);
imagepng ($im);
imagedestroy($im);
?>
and in the contact.php page I use the following html
<img src="image.php" />
and this displays an image with a random number.
However, This random number isn't available to the form, & I need to pass somehow the value of the random number to the "dothesefunctions.php" script to check that the user has entered the code displayed on the image.
I am at a loss for ideas? Can anyone help?
many thanks.
S