Jump to content
Larry Ullman's Book Forums

Recommended Posts

For the spam scrubber function, I noticed that when I sticky the posted value from the comments text area back into the comments text area, all the newlines are removed.

 

I tried using the nl2br and str_replace functions to change the newlines to <br> elements, but to no avail.

 

Has anyone else encountered this issue and have a workable solution?

 

Thank you.

 

(By the way, I'm running PHP 5.2.x and MySQL on an Apache server.)

Link to post
Share on other sites

All right, I pulled a total newb move there. I totally missed something obvious.

 

When I wrote the spam scrubber function last night, I wasn't thinking about what I was writing, and sure enough (as Larry explicitly says in the book), using the str_replace function to scrub your emails will mess up the formatting. Duh!

 

Well, at least I solved it; just took out the str_replace function call at the end of the spam scrubber function.

Thanks.

Link to post
Share on other sites
  • 2 weeks later...

Hi,

 

i have used the spam_scrubber function on a form in which I have included a drop down list and radio buttons.

 

When I use the spam_scrubber function to validate the other text areas, that it works fine, however once I select something I get a the following warnning message:

 

Warning: stripos() expects parameter 1 to be string, array given in file name on line 18.

 

line 18 is :

f(stripos($value, $v)!==false)

)

However I think the error is generated from the line

 

$scrubbed=array_map('spam_scrubber', $_POST);

 

i.e. the $value has to be a string for the function to work and since my select box returns an array, there is a problem, hence the error message.

 

Is there a way around this,other than using a @ in front of the line above?

 

Thanks,

LF

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...