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 comment
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 comment
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 comment
Share on other sites

 Share

×
×
  • Create New...