1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-19 22:53:03 +05:30

(feat): implemented basic backend recapcha validation

This commit is contained in:
2023-12-10 19:11:11 +05:30
parent 6a7e646df2
commit f7ecbcf334

View File

@@ -20,8 +20,27 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$message = form_input_filter($conn, $formData['message']);
$recaptcha = form_input_filter($conn, $formData['recaptcha']);
$alertMessage = "Form Data Recived from ".$name;
$alertType = "success";
if($name !== "" && $email !== "" && $message !== "") {
if($recaptcha !== "") {
$secret = '';
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . $secret . '&response=' . $recaptcha);
$responseData = json_decode($verifyResponse);
if($responseData->success) {
}
else {
}
}
else {
}
}
else {
}
echo json_encode(array("alert" => $alertMessage, "alertType" => $alertType));
}
}