| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)gepgroup.hk/ |
Upload File : |
<?php
$without_session_start = true;
require_once( realpath(dirname(__FILE__)) . '/common/config.php');
// check is post
if (strtoupper($_SERVER['REQUEST_METHOD']) != 'POST')
{
echo '{ "result":"Failure" }';
exit;
}
// reCAPTCHA
$api_param = array(
'secret' => '6LfEmgETAAAAABDIgFhwd1lYr3wO5cZFNzxbvs2X',
'remoteip' => $_SERVER['REMOTE_ADDR'],
'response' => $_POST['g-recaptcha-response']
);
$api_url = 'https://www.google.com/recaptcha/api/siteverify?'. http_build_query($api_param);
$json = file_get_contents($api_url);
$response = json_decode($json);
// echo $response->access_token;
if ( $response->success !== true )
{
echo '{ "result":"Failure" }';
exit;
}
//ini_set('display_errors', 1);
//error_reporting(E_ALL);
// Create contact us log
$log = new LogContactUsEmail(array(
'ip_address' => $_SERVER["REMOTE_ADDR"],
));
$log->safe_set_attributes($_POST);
// Save log
$is_saved = $log->save();
// to
$to_emails = array();
$contact_us_email_to = Miscellaneous::key('contact_us_email_to');
if (!empty($contact_us_email_to->value)){
$lists = explode(',', $contact_us_email_to->value);
foreach($lists as $email){
$to_emails[] = trim($email);
}
}
// body
ob_start();
?><div><pre>You have a message via GEP Group Website contact us form.
The following information are the details,
Name: <?=$log->name?>
Email: <?=$log->email?>
Subject: <?=$log->subject?>
Message:
<?=$log->message?>
--- End of Description --</pre></div><?php
$body = nl2br(ob_get_contents());
ob_end_clean();
// Send email
require_once( realpath(dirname(__FILE__)) . '/function_mail.php');
$x_mail = create_mail();
$x_mail->From = $log->email;
$x_mail->FromName = $log->name;
foreach ($to_emails as $to_email)
$x_mail->AddAddress($to_email);
$x_mail->Subject = "Website Enquiry - gepgroup.hk";
$x_mail->Body = $body;
$is_send = $x_mail->Send();
if ($is_saved && $is_send) {
echo '{ "result":"Success" }';
} else {
$errors = array();
if (!$is_send)
$errors[] = '"Send mail"';
if (!$is_saved)
$errors[] = '"Save mail"';
$reason = implode(',', $errors);
echo '{ "result":"Failure","reason": [' . $reason . '] }';
}
?>