Jump to content
Larry Ullman's Book Forums

Recommended Posts

I'm using the script in Ch 13 to prevent spam from entering my form. I created a form based off the book in (Ch 11 Sending Emails) except with an addition of checkboxes. Everything is working except the thank you message after it's sent.

 

The message: Warning: stripos() expects parameter 1 to be string, array given in /home/content/70/11385670/html/new_view.php on line 49

Thank you for contacting me! I will reply soon.

 

 

The message is referring to the line highlighted in red
 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
 
function spam_scrubber($value) {
// List of bad values:
$very_bad = array('to:', 'cc:', 'bcc:', 'content-type:', 'mime-version:', 'multipart-mixed:', 'content-transfer-encoding:');
// If bad values, return empty string:
foreach ($very_bad as $v) {
if (stripos($value, $v)!== false) return '';
}
// Replace any newline characters with spaces:
$value = str_replace(array("\r", "\n", "%0a", "%0d"), ' ', $value);
// Return the value:
return trim($value);
} //End of spam_scrubber() function
 
 
Any help would be appreciated!
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...