You are here: Re: Implemented php script to send e-mail « PHP Programming Language « IT news, forums, messages
Re: Implemented php script to send e-mail

Posted by macca on 09/07/07 11:50

>$name = ltrim(rtrim(strip_tags(stripslashes($_POST['name']))));
>$email = ltrim(rtrim(strip_tags(stripslashes($_POST['email']))));
>$subject = ltrim(rtrim(strip_tags(stripslashes($_POST['subject']))));
>$msg = ltrim(rtrim(strip_tags($_POST['msg'])));



Not really an answer to your question, just a tip. You shouldnt repeat
code like this really,plus you dont need left trim and right trim
seperately, just call trim() which will do doth.

create a "sanitize" function:



function sanitize($dirty_data)(

$clean_data = trim(strip_tags(stripslashes($dirty_Data)));

return $clean_data;
}


Then:

$name = sanitize($_POST['name']);
$email = sanitize($_POST['email']);
$subject = sanitize($_POST['subject']);
$msg = sanitize($_POST['msg']);


Makes you code clearer and you can then re-use the function in any of
your applications then.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация