メールを送信する次のコードがあります。
これは、本番環境に十分な安全性と安全性を備えていますか? つまり、ボット、それを使用してスパムを送信するカール スクリプト、電子メール インジェクションなどを停止しますか?
<?php
require_once('recaptchalib.php');
$privatekey = "private keys goes here";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again. " .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
require 'class.phpmailer.php';
//Create a new PHPMailer instance
$mail = new PHPMailer();
//Set who the message is to be sent from
$mail->SetFrom('oshirowanen@localhost.com');
//Set who the message is to be sent to
$mail->AddAddress($_POST['email']);
//Set the subject line
$mail->Subject = 'subject goes here';
//Replace the plain text body with one created manually
$mail->Body = $_POST['message'];
//Send the message, check for errors
if(!$mail->Send()) {
die ("Mailer Error: " . $mail->ErrorInfo);
} else {
echo "Message sent!";
}
}
?>
基本的に、私が求めているのは、上記のコードは十分に安全で、十分に安全で、本番環境に十分適しているかということです.