|
Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /proc/self/root/var/www/iatax.com.au/public_html/ |
Upload File : |
<?php
// Start the session
session_start();
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
require './PHPMailer/src/Exception.php';
require './PHPMailer/src/PHPMailer.php';
require './PHPMailer/src/SMTP.php';
if(!isset($_POST)) {
echo 'invalid'; exit;
}
if($_POST['g-recaptcha-response'] == '')
{
header('Location: https://www.iatax.com.au/contact?failmessage=true');
}
//check for recaptcha
$request_body = array(
'secret' => '6Lf5NlgpAAAAAK4z9KUWLwxqp1QtTFegxJt1LiKg',
'response' => $_POST['g-recaptcha-response'],
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $request_body);
$result = curl_exec($ch);
curl_close($ch);
$response_data = json_decode($result);
if(isset($response_data->success) && $response_data->success)
{
$mail = new PHPMailer(TRUE);
/* Open the try/catch block. */
try {
// $mail->SMTPDebug = SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->Host = 'esmsfauditors.com.au';
$mail->SMTPAuth = true;
$mail->Username = 'postmaster@esmsfauditors.com.au';
$mail->Password = 'EwX8%gIzSp%t';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
$mail->CharSet = PHPMailer::CHARSET_UTF8;
$mail->setFrom('noreply@iatax.com.au', 'Iatax Website');
$mail->addAddress('admin@iatax.com.au', 'Admin');
$mail->isHTML(true);
$mail->Subject = 'Iatax Website Visitor Inquiry';
$mail->Body = '
First Name: ' . $_POST['firstname'] . '<br><br>
Last Name: ' . $_POST['lastname'] . '<br><br>
Email: ' . $_POST['email'] . '<br><br>
Phone: ' . $_POST['phone'] . '<br><br>
Preferred Call Time: ' . $_POST['time'] . '<br><br>
Message: ' . $_POST['message'];
$mail->send();
}
catch (Exception $e)
{
echo $e->errorMessage();
exit;
}
catch (\Exception $e)
{
/* PHP exception (note the backslash to select the global namespace Exception class). */
echo $e->getMessage();
exit;
}
$_SESSION["contacform_sent"] = "yes";
header('Location: '. 'https://www.iatax.com.au/contact/thankyou');
}
else
{
header('Location: https://www.iatax.com.au/contact?failmessage=true');
}