dongyun65343 2012-09-07 21:32
浏览 96
已采纳

php mail()删除CC,BCC和安全性

I'm new to stackoverflow and couldn't find an answer to my question which is; How do I secure my mail() code in php to prevent people from adding bcc which would ultimatly result in mass mailing? My website uses the PHP mail() service to email me when a new comment has been entered in my site. What is the best way to prevent people tampering with it, such as removing the bcc? What I have so far is:

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']));

$to = 'myself@gmail.com';
$subject = 'Website - comment';
$body = 'A new comment has been entered on the website.'."

"."$name".' said:         '."

"."$comment";
mail($to,$subject,$body);
  • 写回答

2条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 就是目前有一个游戏程序,需要根据一些要求修改
      • ¥15 关于#python##pyqt#的问题,如何解决?
      • ¥15 html+css网页设计 html+css网页设计
      • ¥15 用html加css制作一个网页
      • ¥200 MFC中如何对ListCtrl的某一列的文本能换行显示
      • ¥15 clion添加库文件
      • ¥15 ERROR C2143怎么出现的?为什么ERROR C2144会这么转移,它是怎么出现的?该怎么解决?
      • ¥15 华大的hc32l136外部中断引脚怎么设置
      • ¥15 这个问题如何解答,需要答案
      • ¥15 ubuntu18.04 tty报错&tty界面su/sudo命令无法执行,如何解决?