5000000 ) { errorOut( "Sorry, your file is too large."); $uploadOk = 0; } if ($_FILES["fileToUpload"]["size"] < 5 ) { errorOut( "Sorry, your file is too small."); $uploadOk = 0; } // Meat: if ($uploadOk) { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { return($target_file); } else { errorOut( "Sorry, there was an error uploading your file." ); } } error_log("why am I here?"); } function bodyBuilder() { global $cfg; global $features; global $services; $body = ''; $body .= 'genFrom: Contact Support Form' . "\n"; $body .= "EMAIL Version: 1.0\n"; $body .= "Local Time: " . date(DATE_RFC2822) . "\n"; $body .= "\n"; $body .= "Category: " . $_REQUEST['category'] . ' - ' . $services[$_REQUEST['category']] . "\n\n"; $body .= "Subcategory:\n"; foreach ($_REQUEST['subcategory'] as $feature) { if (! isset($feature)) { continue; } $body .= " Feature: " . $feature . ' - ' . $features[$feature] . "\n"; } #$body .= "\nShort Description: " . $_REQUEST['shortDesc'] . "\n\n"; $body .= "\nProperty Name: " . $_REQUEST['propertyname'] . "\n\n"; $body .= "Maestro Client ID: " . $_REQUEST['mcid'] . "\n\n"; $body .= "Name: " . $_REQUEST['nameFreeForm'] . "\n\n"; $body .= "Phone: " . $_REQUEST['phoneNumber'] . "\n\n"; $body .= "Email: " . $_REQUEST['email'] . "\n\n"; $body .= "Detailed Description: " . $_REQUEST['detailedDesc'] . "\n\n"; #$body .= "
\n\n" . print_r($_REQUEST,true); $body .= "\n"; return($body); } /* * * MAIN * */ $passCaptchaTest = 0; $captchaKeyPublic = '6LfdjMIUAAAAAJZmSlyCql9P6uwuXOjvLvckw6Lw'; $captchaKeyPrivate = '6LfdjMIUAAAAAPEeTSSGEBEXbhU6TA37rXWPj4AG'; $responseToken = ''; if (isset($_REQUEST['g-recaptcha-response'])) { $responseToken = $_REQUEST['g-recaptcha-response']; $url = 'https://www.google.com/recaptcha/api/siteverify'; $data = array( 'secret' => $captchaKeyPrivate, 'response' => $_POST["g-recaptcha-response"] ); $options = array( 'http' => array ( 'header' => "Content-Type: application/x-www-form-urlencoded\r\n". "User-Agent:MyAgent/1.0\r\n", 'method' => 'POST', 'content' => http_build_query($data) ) ); $context = stream_context_create($options); $verify = file_get_contents($url, false, $context); $captcha_success=json_decode($verify); if ($captcha_success->success==true) { $passCaptchaTest = 1; } } if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'submitContactSupportFormV2' && $_REQUEST['propertyname'] != '' && $passCaptchaTest) { $to = $cfg['destEmail']; $from = $cfg['fromEmail']; $subject = 'ContactSupportFormV2 - ' . $_REQUEST['propertyname'] . ""; $body = bodyBuilder(); $attachment = saveAttachements(); $email = new PHPMailer(); # $email->SMTPDebug = 2; // Enable verbose debug output $email->isSMTP(); // Set mailer to use SMTP $email->Host = $cfg['SMTP_host']; // Specify main and backup SMTP servers $email->Port = $cfg['SMTP_port']; // TCP port to connect to $email->SetFrom($from); //Name is optional $email->Subject = $subject; $email->Body = $body; $email->AddAddress( $to ); if ($attachment) { $email->AddAttachment( $attachment , $_FILES["fileToUpload"]["name"] ); } $email->Send(); require($thankyouTemplate); if (isset($attachment)) { unlink($attachment); } } else { // load and present form require($formTemplate); } ?>