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.
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…
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
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:
Comment out the problem lines (add // to the beginning of the line)
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: