Я пытался добавить проверки reCaptcha из Google, проблема в том, что после попытки отправить его перемещает меня непосредственно в form.php, в domain / form.php, и сообщение не отправляется.Ниже я отправляю код, заранее благодарю за помощь в решении проблемы
<?php
if (isset($_POST['submit'])) {
$secret = '6LclC3QUAAXXXXXXXXXXXXXXXX5hrAxfHXXXiMH';
$response = $_POST['g-recaptcha-response'];
$remoteip = $_SERVER['REMOTE_ADDR'];
$url = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$response&remoteip=$remoteip");
$result = json_decode($url, TRUE);
if ($result['success'] == 1) {
$to = 'XXX@mail.com'; // Put in your email address here
$subject = "Nowe zlecenie"; // The default subject. Will appear by default in all messages. Change this if you want.
// User info (DO NOT EDIT!)
$name = stripslashes($_REQUEST['name']); // sender's name
$email = stripslashes($_REQUEST['mail1']); // sender's email
$servicetype = stripslashes($_REQUEST['service-type']);
$vehicalmake = stripslashes($_REQUEST['vehical-make']);
$vehicalmodel = stripslashes($_REQUEST['vehical-model']);
$appointmentdate = stripslashes($_REQUEST['appointment-date']);
$appointmenttime = stripslashes($_REQUEST['appointment-time']);
$phone = stripslashes($_REQUEST['phone']);
$message = stripslashes($_REQUEST['message']);
$mail1 = stripslashes($_REQUEST['mail1']); // sender's email
$msg = "";
// The message you will receive in your mailbox
// Each parts are commented to help you understand what it does exaclty.
// YOU DON'T NEED TO EDIT IT BELOW BUT IF YOU DO, DO IT WITH CAUTION!
$msg .= "Imie i nazwisko : ".$name."\r\n\n"; // add sender's name to the message
$msg .= "Adres e-mail: ".$mail1."\r\n\n"; // add sender's email to the message
$msg .= "Numer telefonu: ".$phone."\r\n\n"; // add sender's sources to the message
$msg .= "Rodzaj uslugi: ".$servicetype."\r\n\n"; // add sender's sources to the message
$msg .= "Typ nadwozia: ".$vehicalmake."\r\n\n"; // add sender's sources to the message
$msg .= "Model auta: ".$vehicalmodel."\r\n\n"; // add sender's sources to the message
$msg .= "Data wykonania: ".$appointmentdate."\r\n\n"; // add sender's sources to the message
$msg .= "Godzina: ".$appointmenttime."\r\n\n"; // add sender's sources to the message
$msg .= "Wiadomosc od kupujacego: ".$message."\r\n\n"; // add sender's checkboxes to the message
$msg .= "\r\n\n";
$mail = mail($to, $subject, $msg, "From:");
if($mail) {
header("Location:index.html");
echo 'send';
} else {
echo 'Message could not be sent!';
}
}else{
echo 'infooo';
}
}
?>