我的联系页面上有Recaptcha和一个表格。一切都已经进行了几个月(直到几个月),直到我不得不更改导航菜单。我这样做之后,“”上方的所有PHP等代码开始显示在页面顶部。它涵盖了我的徽标和导航栏。我能做什么?有人可以帮忙吗?
<?php
require( 'recaptcha-master/src/autoload.php' );
$siteKey = '6LcM_wkUAAAAALpmz...';
$secret = '6LcM_wkUAAAAAJO-U04kp...';
$recaptcha = new\ ReCaptcha\ ReCaptcha( $secret, new\ ReCaptcha\ RequestMethod\ SocketPost() );
if(!empty($ _POST)和isset($ _POST ['g-recaptcha-response'])):
$gRecaptchaResponse = $_POST[ 'g-recaptcha-response' ]; //google captcha post data
$remoteIp = $_SERVER[ 'REMOTE_ADDR' ]; //to get user's ip
$recaptchaErrors = ''; // blank varible to store error
$resp = $recaptcha->verify( $gRecaptchaResponse, $remoteIp ); //method to verify captcha
if ( $resp->isSuccess() ) {
// send mail or insert in db or do whatever you wish to
$headers = 'From: CBS.Website - info@cb.com.';
$emailbody = 'Name: ' . $_POST[ 'name' ] . "\n"
. 'Company: ' . $_POST[ 'company' ] . "\n"
. 'Email: ' . $_POST[ 'email' ] . "\n"
. 'Phone: ' . $_POST[ 'phone' ] . "\n"
. 'Referral: ' . $_POST[ 'referral' ] . "\n"
. 'Stage: ' . $_POST[ 'stage' ] . "\n"
. 'Budget Range: ' . $_POST[ 'budget' ] . "\n"
. 'Geographic Location: ' . $_POST[ 'location' ] . "\n"
. 'Type: ' . $_POST[ 'type' ] . "\n"
. 'Special Considerations: ' . $_POST[ 'considerations' ] . "\n"
. 'Project Type: ' . $_POST[ 'projectType' ] . "\n"
. 'Square Footage: ' . $_POST[ 'sqfootage' ] . "\n"
. 'Number of Stories: ' . $_POST[ 'stories' ] . "\n"
. 'Schedule: ' . $_POST[ 'schedule' ] . "\n"
. 'SF Budget: ' . $_POST[ 'sfbudget' ] . "\n"
. 'Future Construction: ' . $_POST[ 'futureConst' ] . "\n"
. 'Special Features: ' . $_POST[ 'features' ] . "\n"
. 'Restrictions: ' . $_POST[ 'restrictions' ] . "\n";
mail( 'sg@cb.com', 'Contact Form Submission', $emailbody, $headers );
echo "<meta http-equiv='refresh' content=\"0; url=thankyou.php\">";
} else {
$recaptchaErrors = $resp->getErrorCodes(); // set the error in varible
}
endif;
?>
<!doctype html>
<html>
<head>