Re: simple scrip to stop email injection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, August 16, 2006 4:53 am, Ross wrote:
>
> Been having loads of problems with this and have solved it using the
> phpmailer. The only problem is I cannot get the class working on the
> remote
> host I am working on. I am back to using mail() but need to drop in
> script
> that checks my fields $fname, $sname, $email, $subject, $message.

Checking for a NEWLINE in all but $message will stop MOST of the email
injection.

if (preg_match("/\r\n/", array($fname, $sname, $email, $subject))){
  die("Spammer!");
}

I think preg_match allows array for 2nd arg...

Details.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux