gpt4 book ai didi

php - reCaptcha 不会重定向到 thankyou.php

转载 作者:搜寻专家 更新时间:2023-10-31 22:04:22 25 4
gpt4 key购买 nike

reCaptcha 工作正常并从我的联系表单发送我的电子邮件,但不会重定向到我的 thankyou.php。就像我说的,我收到了电子邮件,但默认为空白 verify.php 屏幕。我认为 header(location:' ') 应该可以工作,但事实并非如此。帮助!我卡住了。

<?php
require_once('folder/recaptchalib.php');
$privatekey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$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 {
// Your code here to handle a successful verification


require_once('folder/email.class.php');


if($_POST){


if ($_POST['leaveblank'] != '' or $_POST['dontchange'] != 'http://'){
echo 'Could not deliver your message, please try again!';
exit;
}

$message = '<p><b>Name:</b> '.$_POST['name'].'</p>';
$message .= '<p><b>Email:</b> '.$_POST['email'].'</p>';
$message .= '<p><b>Phone:</b> '.$_POST['phone'].'</p>';
$message .= '<p><b>City:</b> '.$_POST['city'].'</p>';
$message .= '<p><b>State:</b> '.$_POST['state'].'</p>';
$message .= '<p><b>Regarding:</b> '.$_POST['regarding'].'</p>';
$message .= '<p><b>Message:</b> '.$_POST['message'].'</p>';

if($_POST['regarding'] == ''){
$to = 'xxxxx@xxxx.com';
$subject = '';
}elseif($_POST['regarding'] == ''){
$to = 'xxxxx@xxxx.com';
$subject = '';
}elseif($_POST['regarding'] == ''){
$to = 'xxxxx@xxxx.com';
$subject = '';
}elseif($_POST['regarding'] == ''){
$to = 'xxxxx@xxxx.com';
$subject = '';
}else{
$to = 'xxxxx@xxxx.com';
$subject = 'Events: Inquiry';
}


$boundary = uniqid('np');

$headers = "From: xxxxx@xxxx.com" . "\r\n";
$headers .= "Reply-To: xxxxx@xxxx.com" . "\r\n";
$headers .= "Return-Path: xxxxx@xxxx.com" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "X-Priority: 1\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1;boundary=" . $boundary . "\r\n";
$headers .= "X-MSmail-Priority: High\n";
//mail($to, $subject, $message, $headers);
email(array($to), $subject, $message);
header('Location:thank-you.php');
}
}
?>

最佳答案

您的页面是叫 thankyou.php 还是 thank-you.php?并尝试完整的 URL:

header('Location: http://www.example.com/thankyou.php');

关于php - reCaptcha 不会重定向到 thankyou.php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21692640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com