Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
prevent spamming with contact form
Old 01-22-2009, 11:15 AM prevent spamming with contact form
Skilled Talker

Posts: 83
Trades: 0
Hi,

To prevent spam sent with my contact form, i found these usefull functions on php.net:

PHP Code:
  /** Check single-line inputs: Returns false if text contains newline character */
  
function has_no_newlines($text) {
     return 
preg_match("/(%0A|%0D|\n+|\r+)/i"$text);
  }
 
  
/** Check multi-line inputs: Returns false if text contains newline followed by email-header specific string*/
  
function has_no_emailheaders($text) {
     return 
preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i"$text);
  } 
 
  if (
has_no_emailheaders($_POST['message']) == false) {
      
//error
  

Now i admit i do not understand the preg_match funtion, but i would say that these functions would output TRUE when a match is found, instead of FALSE like mentioned in the comment. Am i wrong?

thanks!

Matt

Last edited by killerwhale65; 01-22-2009 at 11:16 AM..
killerwhale65 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-22-2009, 11:26 AM Re: prevent spamming with contact form
Insensus's Avatar
Ultra Talker

Posts: 487
Name: Mark Stegeman
Location: Netherlands, Europe
Trades: 0
You're not wrong.
__________________
<?php ($helpfull>0)?$talkupation++ : '';?>
Insensus is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to prevent spamming with contact form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09614 seconds with 12 queries