php contact form needed

Cliff

Perch
I'm looking for a php contact form that makes the user type in a string that they see in an image before submitting the form. It must work on Windows too.

I have a customer that currently has a form that they are receiving 30+ emails a day from bogus people, probably a bot of some sort I'm guessing. If you've encountered this and know how to prevent it please let me know.

I tried searching on HotScripts, but didn't have much luck.

Thanks,
Cliff
 
Doesn't look like it provides the security box where you type in the string you see in the image.

Thanks for trying though.
 
I finally found one. Only thing now is that I'm getting some warnings that are displaying on the page for a few seconds. I commented out the lines and it still works.

Can anybody tell me what these two lines do? I'm new to PHP...

PHP:
   $_POST['email'] = preg_replace("\r", "", $_POST['email']);
   $_POST['email'] = preg_replace("\n", "", $_POST['email']);

These two lines are causing these warnings:

Code:
Warning: preg_replace(): Empty regular expression in D:\hshome\*****\****.com\contact\send.php on line 40

Warning: preg_replace(): Empty regular expression in D:\hshome\*****\****.com\contact\send.php on line 41

Code can be downloaded here:
http://www.quinti.net/recursos.php?idioma=en

Thanks,
Cliff
 
It looks like the code is trying to remove carriage returns and new line characters. preg_replace uses regular expressions, but \r and \n aren't valid regular expressions, hence the warnings.

I'm not sure why you'd want to replace the \r and \n characters. So, I'd do one of these things to fix the problem:

1. Comment out the problem lines (add // to the beginning of the line)

2. Add this statement to the beginning of the code:

error_reporting(E_ERROR | E_PARSE);

which directs PHP to report only actual code errors and parse errors (syntax errors). Thus, the warnings you're receiving won't be displayed.

If you do think you want \r and \n removed, change those two lines to:

Code:
$_POST['email'] = str_replace("\r", "", $_POST['email']);
$_POST['email'] = str_replace("\n", "", $_POST['email']);

Tim
 
Back
Top