<?php

/** 
* 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) == 0;


/** 
* 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) == 0;


?>