我是stackoverflow的新手,无法找到我的问题的答案。 如何在php中保护我的mail()代码以防止人们添加最终会导致群发邮件的密件抄送? 我的网站使用PHP mail()服务在我的网站上输入新评论时给我发电子邮件。 防止人们篡改它的最佳方法是什么,例如删除密送? 到目前为止我所拥有的是: p>
function mres($ input){
if(get_magic_quotes_gpc()){
$ input = stripslashes($ input);
}
return mysql_real_escape_string($ input);
}
$ name = strip_tags(mres($ _ POST ['name']));
$ comment = strip_tags(mres($ _ POST ['comment'])); \ n
$ to ='myself@gmail.com';
$ subject ='网站 - 评论';
$ body ='已在网站上输入新评论。'。“
”。 “$名”。” 说:'。“
”。“$ comment”;
mail($ to,$ subject,$ body);
code> pre>
div>